Download MCS Electronics , 1995-2008 - Departamento de Automatización y

Transcript
702
BASCOM-AVR
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
ISO characterT
number
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
Example
'---------------------------------------------------------------------------------------'name
: magcard.bas
'copyright
: (c) 1995-2005, MCS Electronics
'purpose
: show you how to read data from a magnetic
card
'micro
: Mega48
'suited for demo
: yes
'commercial addon needed : no
'---------------------------------------------------------------------------------------$regfile = "m48def.dat"
the used micro
$crystal = 4000000
crystal frequency
$baud = 19200
rate
$hwstack = 32
use 32 for the hardware stack
$swstack = 10
use 10 for the SW stack
$framesize = 40
use 40 for the frame space
' specify
' used
' use baud
' default
' default
' default
'[reserve some space]
Dim Ar(100) As Byte , B As Byte , A As Byte
'the magnetic card reader has 5 wires
'red
- connect to +5V
© 2008 MCS Electronics