Solved

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

Posted on 2000-05-11
5
340 Views
Last Modified: 2013-11-25
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...
0
Comment
Question by:dansvb
[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
5 Comments
 
LVL 2

Expert Comment

by:BobbyOwens
ID: 2801451
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

0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2801456
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.).
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2801510
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.).
0
 

Author Comment

by:dansvb
ID: 2806892
Will get you more info Monday...  Thanks for fast response...
0
 
LVL 1

Accepted Solution

by:
csameer1 earned 100 total points
ID: 2843593
Remember that the rs232 port lines are at +/- 12V .You can connect the DSR or CTS lines to your input.

You just have to check the line status as follows

if MsComm1.CTSHolding = true then....

if MsComm1.DTRHolding = true then....

I have use this method to signal a UPS low battery indicator.I am not sure how fast you can count.If you need more speed use Parallel Port.

Let me know if uyou need more info
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

690 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