lansing123
asked on
Magnetic Stripe Reader/Writer?
Can anybody give me a instruction or a sample code on reading and writing to a card using magnetic Stripe Reader/Writer model MSE-630HL using Visual Basic MSCOMM control. I have the command but my problem is how to wait until such time that the user swiped the card.
im willing to add more points.
thanks in advance
im willing to add more points.
thanks in advance
Except there is no "expected read length" with magstripe cards. It could be 1 digit, it could be 20 digits. Better off having a timer that starts when the first character is received. If 100-250 ms goes by and no more characters received, you can assume that's the end of the stream. The magstripe reader will not send any data until it has ALL of the data to send, all in one block.
True Scott, but I am assuming (possibly wrongly) that this is for an application such as an in-house security or identification system. In this case it is likely that the Data on the card will be of fixed length.
ASKER
ok here is my problem.
I have a READ command button on my form. What I want is when I click the READ button, the magnetic stripe reader/writer device will wait for the card to be swiped.
how can i do that in VB?
I have a READ command button on my form. What I want is when I click the READ button, the magnetic stripe reader/writer device will wait for the card to be swiped.
how can i do that in VB?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks scot but it still not working, its just keep on looping. no response when i swipe the card.
Does the green light come on the reader when you click the form button?
ASKER
actually when i clicked the button, the yellow and green light turned off then turned on again.
Well, that shows it's at least doing the reset. Perhaps you might try the "Wait 1 second" timeouts to 3 or 4 seconds? Then click it, wait for the light to come on, then swipe a card.
ASKER
is it normal that all the light(red, yellow and green) are all on?
I don't know, I've never actually seen that reader. I don't know if the lights are actually controlled by the unit to indicate bad reads etc. or if they are manually controlled only by the software.
Hi lansing123,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept ScottNero's comment(s) as an answer.
*** heroic effort, then asker quit responding alas!
lansing123, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Accept ScottNero's comment(s) as an answer.
*** heroic effort, then asker quit responding alas!
lansing123, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer
Computer101
E-E Moderator
Computer101
E-E Moderator
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
In the comEvReceive section you can then handle the data received. You don't have to worry about anything else as this event will be fired when there is data in the receive buffer. Of course I would also make sure that you set the RThreshold property to the length of the expected read so that you get it in one receipt otherwise you may have to handle receiving the data in more than one event.