[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2000-05-11
5
Medium Priority
?
344 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 300 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses

650 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