Link to home
Start Free TrialLog in
Avatar of dansvb
dansvb

asked on

Need a way to count coin drops (pulses) being recieved through serial port com 2

Trying to get or write visual basic code that willrecognise and count coin drops (pulses) being recieved through serial port com 2.
Open to suggestions and or any solution...
Avatar of BobbyOwens
BobbyOwens

Have you tried adding "Microsoft Comm Control" to your project. You should be able to monitor the Comm port. Just choose the comm port settings then put code in the oncomm event. Heres and example:

The following example shows how to handle communications errors and events. You can insert code after each related Case statement, to handle a particular error or event.

Private Sub MSComm_OnComm ()
   Select Case MSComm1.CommEvent
   ' Handle each event or error by placing
   ' code below each case statement

   ' Errors
      Case comEventBreak   ' A Break was received.
      Case comEventFrame   ' Framing Error
      Case comEventOverrun   ' Data Lost.
      Case comEventRxOver   ' Receive buffer overflow.
      Case comEventRxParity   ' Parity Error.
      Case comEventTxFull   ' Transmit buffer full.
      Case comEventDCB   ' Unexpected error retrieving DCB]

   ' Events
      Case comEvCD   ' Change in the CD line.
      Case comEvCTS   ' Change in the CTS line.
      Case comEvDSR   ' Change in the DSR line.
      Case comEvRing   ' Change in the Ring Indicator.
      Case comEvReceive   ' Received RThreshold # of
                        ' chars.
      Case comEvSend   ' There are SThreshold number of
                     ' characters in the transmit
                     ' buffer.
      Case comEvEof   ' An EOF charater was found in
                     ' the input stream
   End Select
End Sub

Can you provide more information.  As BobbyOwens shows, it is easy to add MSComm (done it hundreds of times).  We would need to see some sort of protocol and settings.  For example, what kind of data do you receive (e.g., "N" for nickel, etc.) or is it just signals?  What are the settings (e.g., 9600 bps, etc.).
Can you provide more information.  As BobbyOwens shows, it is easy to add MSComm (done it hundreds of times).  We would need to see some sort of protocol and settings.  For example, what kind of data do you receive (e.g., "N" for nickel, etc.) or is it just signals?  What are the settings (e.g., 9600 bps, etc.).
Avatar of dansvb

ASKER

Will get you more info Monday...  Thanks for fast response...
ASKER CERTIFIED SOLUTION
Avatar of csameer1
csameer1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial