READMAGCARD
Action
Reads data from a magnetic card reader.

Syntax
READMAGCARD var , bytes , code, timeout

Remarks

Var A byte array large enough to store the data from the magnetic card reader.
bytes The number of bytes read from the card.
Shifts The coding used. Must be 5 or 7. In version 2.03 only 5 is supported.
Timeout A LONG variable or constant that the routine will wait for a card. Err will be set when no card is detected within Timeout.
There can be 3 tracks on a magnetic card.
Track 1 stores the data in 7 bit including the parity bit. This is handy to store alpha numeric data.
On track 2 and 3 the data is stored with 5 bit coding.
The ReadMagCard routine works with ISO7811-2 5 and 7 bit decoding.
The returned numbers for 5 bit coding are:

Returned number ISO character:
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 hardware control
11 start byte
12 hardware control
13 separator
14 hardware control
15 stop byte
See also


Calls
_Read_Magcard_Code5

Example

'[DIM used variables]
Dim X(40) As Byte , I As Byte , Bts As Byte

'[ALIAS the pins used]
_mcs Alias P1.1
_mclock Alias P1.2
_mdata Alias P1.0

Do
Print "Slide magcard through reader"
Readmagcard X(1) , Bts , 5, 10000 'call routine
' ^ may be 5 or 7. 7 bit coding not implemented yet

Print "Error " ; Err '1 if error occurred
Print ; " " ; Bts ; " bytes read" 'show number of bytes read

Print Err
For I = 1 To Bts
Print X(i) ; " "; 'show number
Next
Print
Loop
End