Hi im using the serial port to poll a RFID reader on the rs232 port of the pda.
The RDIF reader uses the CTS to indicate its ready status. I noticed in my code that i had not set CTSHandshaking to TRUE which explained the varied results i was getting. However, when i enabled this feature all i get is an exception when i try to transmit any data;
my serial setup code is;
If serial.PortOpen = False Then
serial.CommPort = 1
serial.StopBits = 17
serial.dataBits = 8
serial.BitRate = 9600
serial.Parity="N"
Serial.Timeout = 220
serial.PortOpen = True
serial.EnableOnComm = False
serial.XonXoffHandshaking = False
serial.CTSHandshaking = True
Sleep(500)
End If
then on a timer to poll for RFID tags i send a byte, wait for the RFID to work and then read back the data
If serial.CTS = False Then
serial.Output( "U" ) ' !!! EXCEPTION HERE !!!
''
Sleep(100)
'' wait for 8 bytes of data
cnt=serial.InBufferCount
timeout=120
Do While (cnt<8) AND (timeout>0)
cnt=serial.InBufferCount
timeout=timeout-1
Sleep(1)
Loop
'' process the 8 bytes etc ....
End If
If i dont set CTSHandshaking to true it all works - well without propper device timing.
Any thoughts / help appreciated !
The RDIF reader uses the CTS to indicate its ready status. I noticed in my code that i had not set CTSHandshaking to TRUE which explained the varied results i was getting. However, when i enabled this feature all i get is an exception when i try to transmit any data;
my serial setup code is;
If serial.PortOpen = False Then
serial.CommPort = 1
serial.StopBits = 17
serial.dataBits = 8
serial.BitRate = 9600
serial.Parity="N"
Serial.Timeout = 220
serial.PortOpen = True
serial.EnableOnComm = False
serial.XonXoffHandshaking = False
serial.CTSHandshaking = True
Sleep(500)
End If
then on a timer to poll for RFID tags i send a byte, wait for the RFID to work and then read back the data
If serial.CTS = False Then
serial.Output( "U" ) ' !!! EXCEPTION HERE !!!
''
Sleep(100)
'' wait for 8 bytes of data
cnt=serial.InBufferCount
timeout=120
Do While (cnt<8) AND (timeout>0)
cnt=serial.InBufferCount
timeout=timeout-1
Sleep(1)
Loop
'' process the 8 bytes etc ....
End If
If i dont set CTSHandshaking to true it all works - well without propper device timing.
Any thoughts / help appreciated !