bmoser
asked on
VB6 - RS485 Communcations
Upgrading a VB6 project from 16 bit to 32 bit. This program will be used on NT machines(32-bit) as well as Windows 95/98.
Old program used the RS232 serial communications where no hardware handshaking took place, ie. RTS line not toggled.
The 32 bit needs to use the RS485 serial communications protocol where RTS line must be toggled, ie. hardware output buffer (UART) needs to be monitored in order to know when to toggle the RTS line.
Is there a way to check and see when the UART buffer has been emptied? It is my understanding that the OutputBufferCount property only moniters the software's output buffer, not hardware.
Old program used the RS232 serial communications where no hardware handshaking took place, ie. RTS line not toggled.
The 32 bit needs to use the RS485 serial communications protocol where RTS line must be toggled, ie. hardware output buffer (UART) needs to be monitored in order to know when to toggle the RTS line.
Is there a way to check and see when the UART buffer has been emptied? It is my understanding that the OutputBufferCount property only moniters the software's output buffer, not hardware.
ASKER
Edited text of question.
If you use the MSComm control, it will handle handshaking. For more detail see "Serial Port Complete":
http://www.amazon.com/exec/obidos/ASIN/0965081923/randygivennancyg/002-9129594-2973007
We have done RS-485 / 422 and RS-232 written in VB. For quick-fixes of some legacy code, we have used existing RS-232 code with RS-485 adapters (no software changes!):
http://www.bb-elec.com/product.asp?dept%5Fid=3&sku=485DRJ
http://www.amazon.com/exec/obidos/ASIN/0965081923/randygivennancyg/002-9129594-2973007
We have done RS-485 / 422 and RS-232 written in VB. For quick-fixes of some legacy code, we have used existing RS-232 code with RS-485 adapters (no software changes!):
http://www.bb-elec.com/product.asp?dept%5Fid=3&sku=485DRJ
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"Setting the SThreshold property to 1 causes the MSComm control to generate the OnComm event when the transmit buffer is completely empty."
Private Sub MSComm_OnComm ()
Select Case MSComm1.CommEvent
...
Case comEvSend
'Fired when buffer is empty (SThreshold = 1)
'Other useful events:
Case comEvCD 'Change in the CD line.
Case comEvCTS 'Change in the CTS line.
Case comEvDSR 'Change in the DSR line.
End Select
End Sub