Solved

VB6 - RS485 Communcations

Posted on 2000-05-09
4
1,192 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
ID: 2792977
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
ID: 2792980
Edited text of question.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2793150
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
ID: 2949538
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

895 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

18 Experts available now in Live!

Get 1:1 Help Now