9 Replies - 7331 Views - Last Post: 17 October 2010 - 02:33 AM Rate Topic: -----

#1 mohnajj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-July 09

MSR206 Magnetic Card Reader

Posted 12 October 2010 - 12:47 AM

Dear Sire

i am new in vb ,

and i need to start programming in MSR206

can you give the code

Best Regards
Is This A Good Question/Topic? 0
  • +

Replies To: MSR206 Magnetic Card Reader

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 469
  • View blog
  • Posts: 4,280
  • Joined: 25-March 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 01:07 AM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 mohnajj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-July 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 01:11 AM

Thank You for your Replay

i have a proplem when i read the input from the mscomm

i t comes like Ascii Code

How Can i Get The Correct MSG.

Private Sub MSComm1_OnComm()

Dim inbuffer() As Byte 'Declare an array of bytes
 Dim i As Long

 Select Case Me.MSComm1.CommEvent

 Case comEvReceive

 ReDim inbuffer(Me.MSComm1.InBufferCount) 'Specify the size of the array. InBuffercount gives the number of characters in the InputBuffer



 inbuffer = Me.MSComm1.Input 'Read the InputBuffer



 For i = 0 To UBound(inbuffer) 'Ubound(inbuffer) gives the upper bound of the array, which is equal to the number of characters in the InputBuffer



 Me.Text1.Text = Me.Text1.Text & inbuffer(i) 'TxtReceive is a text box



 Next i

 End Select

End Sub



Edited by macosxnerd101: Please, :code:.
Was This Post Helpful? 0
  • +
  • -

#4 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 469
  • View blog
  • Posts: 4,280
  • Joined: 25-March 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 01:45 AM

so you say is that you get the ascii code of the characters from the MSComm object?
the use Chr() function:
Function Chr(CharCode As Long)
Member of VBA.Strings
Returns a string containing the character associated with the specified character code

Was This Post Helpful? 0
  • +
  • -

#5 mohnajj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-July 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 01:50 AM

ok , i use the chr$() to convert it to string

but the result is like this

s" (Nfu+L?0

thnaks
Was This Post Helpful? 0
  • +
  • -

#6 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 469
  • View blog
  • Posts: 4,280
  • Joined: 25-March 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 02:09 AM

what kind of data should you get. and are you sure it`s not hex instead of ascii code
Was This Post Helpful? 0
  • +
  • -

#7 mohnajj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-July 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 02:36 AM

i use the TYSSO MSE-750 Device

when i send , i send in Hex Decimal

  'Read Card
  MSComm1.Output = Chr$(27) & Chr$(&H6D)

but when i get the output wihout Char$() "Text1.Text = Me.Text1.Text & inbuffer(i)"


the Output is 270115027010280162034324007801770102011704307661600000000
00000000000000000000000000000027020002703000630280270480


when i use the Chr$() "Text1.Text = chr$(Me.Text1.Text) "
The Output is

For i = 0 To UBound(inbuffer) 
   Text1.Text = Me.Text1.Text & Chr$(inbuffer(i)) 'TxtReceive is a text box
Next i

the output is :
s¢" (N±fu+L ?0


i don't know , ma be i forget somthing .



below is the CODE

Private Sub Command1_Click()
 MSComm1.Tag = &H72
       MSComm1.Output = Chr$(27) & Chr$(&H72)
 
        
End Sub



Private Sub Form_Load()
With MSComm1

      'make sure the serial port is not open

     If .PortOpen Then .PortOpen = False

      .Settings = "9600,n,8,1"

     .CommPort = 5         'puerto de la lectora

      .PortOpen = True

      .RThreshold = 1

    End With



 End Sub


Private Sub MSComm1_OnComm()

Dim inbuffer() As Byte 'Declare an array of bytes
Dim i As Long
Select Case Me.MSComm1.CommEvent
Case comEvReceive
ReDim inbuffer(Me.MSComm1.InBufferCount) 'Specify the size of the array. InBuffercount gives the number of characters in the InputBuffer

inbuffer = Me.MSComm1.Input 'Read the InputBuffer

For i = 0 To UBound(inbuffer) 'Ubound(inbuffer) gives the upper bound of the array, which is equal to the number of characters in the InputBuffer

Me.Text1.Text = Me.Text1.Text & inbuffer(i) 'TxtReceive is a text box

Next i
End Select

 
End Sub



thanks

Edited by macosxnerd101: Please, :code:.
Was This Post Helpful? 0
  • +
  • -

#8 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 469
  • View blog
  • Posts: 4,280
  • Joined: 25-March 09

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 02:46 AM

well i`m not familiar with this device. but read the sheet and see what result should it return and in what format.
Was This Post Helpful? 0
  • +
  • -

#9 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12276
  • View blog
  • Posts: 45,364
  • Joined: 27-December 08

Re: MSR206 Magnetic Card Reader

Posted 12 October 2010 - 04:21 AM

Topic split. Please avoid necroposting.
Was This Post Helpful? 1
  • +
  • -

#10 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 330
  • View blog
  • Posts: 1,997
  • Joined: 26-March 09

Re: MSR206 Magnetic Card Reader

Posted 17 October 2010 - 02:33 AM

If you're reading magnetic swipe cards, then I'm assuming that you have a defined test card, otherwise, how will you know that what you're reading is right or wrong?

What data do you expect back from your test card and how does it compare to what you read?

Have you got the DIP switches set on the device as to how you want to use it and the comm port settings set according to the device configuration?

The device comes with a utility whereby you can check your comms settings and see what is being read from the card on all three tracks.

It might be worth installing that and verifying it against what you have in code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1