Solved

VB6 - RS485 Communcations

Posted on 2000-05-09
4
1,178 Views
Last Modified: 2010-07-27
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.
0
Comment
Question by:bmoser
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
From Help:

"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
0
 

Author Comment

by:bmoser
Comment Utility
Edited text of question.
0
 
LVL 9

Expert Comment

by:GivenRandy
Comment Utility
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
0
 
LVL 9

Accepted Solution

by:
GivenRandy earned 50 total points
Comment Utility
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
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now