Solved

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

Posted on 2000-05-11
5
333 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
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

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

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 115
Dialogbox API leak? 18 83
Access 2013 combo box not working 3 38
Recommendation vb6 to vb.net or others 14 114
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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

863 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

23 Experts available now in Live!

Get 1:1 Help Now