Member Login
 ѤҪԡ
 к:
ʼҹ?
ʶԵҪԡ:
Total:16,610
Latest:suchartnmb 
Onlines:
ؤŷ:61 

Category

ѺҨҡ RS-232 VB (HW interface ͹1)

All Articles >> VB >> - ѺҨҡ RS-232 VB (HW interface ͹1)

ǧ͡¹Ǻ駾쵢ҹо͹ء¡Ҩŧ͹ ͧ蹵ѹ褧´ҡѡǹ˭ҹǪҭŧ ¤ҴҨ͡ 2 ͹Ѻ

1. ¹ѺҨҡ RS-232 ҡػó ŵ 繵
2. ¹Դ;쵢ҹѺٷչ portout пѧѹ portin ź io.dll ͡ǹ᷹ inpuot.dll (Ѳ Jan AxelSon) ͧҡѹտѧѹҡҹФѺ

͹ 1 ¹ѺҨҡ RS-232

1. ͡˹鹰ҹѺ÷ͧѺ觢żҹ͹ء
1.1 õԧҧ๤ DB9 ¡Ѻö觢ҧͧ(͹๤ҹ繵Ǽ)
1.2 ҵͧ÷ͺѺ觢źͧҤ (Tx) ҤѺ (Rx) ¡õ͢ 2 Т 3 ͧ´ҹҡѺҴ¡ѹ
1.3 ö Hyper Terminal ͺѺ觢蹡ѹ

    Ѻ VB դ͹ Mscomm ѺѺ觢żҹ͹ء 觨ж١Դŧ㹴տŷͧź͡ Ҩеͧͧ¡ ctrl+T VBIDE ͡ Microsoft Comm Control 6.0

2. Hyper Terminal ѺõǨͺŨҡԨԵŵ
    2.1 ҡѺ͹ءͧ

   2.2  probe ҡѺ power supply ҡٻ power supply ѹҤѺ display ç 5555

ҹ +15.32 ŵ

 2.3  RS-232 ѹ Hyper terminal 㹿Ҩҹ 21532<40=

      2 ʴ display Ẻ 2 digit
      1532 çѹ 15.32 ŵ
       <40= ˹Ѵçѹ俿ҡʵç

3. չҡ͡Ẻͧҡѹ

Option Explicit
Private Sub Form_Load()
    MSCom.Settings = "2400,N,7,1"   '˹ setting çѺ manual ͧ
    MSCom.RThresholdv = 1  '˹Դ event OnComm
    MSCom.CommPort = 1  '͡
End Sub

Private Sub cmdOpenPort_Click()
    MSCom.PortOpen = True  'Դ
End Sub


Private Sub cmdSend_Click()
If MSCom.PortOpen Then
    MSCom.Output = txtSend.Text & vbCrLf    '觤Ҩҡ txtSend
    txtSend.Text = ""
    txtReceive.Refresh
    txtSend.SetFocus
End If
End Sub

Private Sub MSCom_OnComm()  'ѹӤѭҡ
Dim buffer As Variant
Dim msg As Integer
If MSCom.CommEvent = comEvReceive Then  'ǨͺҶ֧ͧ¡õǨҡ event comEvReceive
   buffer = MSCom.Input
   txtReceive.Text = txtReceive.Text & buffer
   txtReceive.Refresh
End If
End Sub

 4. ҡ鹡ѹ

Ҩ͹Ѻ Hyper Terminal չҡö任ء㹧ҹҧ 蹷ͧ auto testing 繵 ҧҨʧҨͧش ԧ áҷص͡Ҩҡ RS-232 ФѺ ǷԴҹҨлҳ 3000 ҷྦྷ¤ѺºѺҧͧդöǡѹҤ٧Ժ

: