Solved

VB6 - RS485 Communcations

Posted on 2000-05-09
4
1,283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

724 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