Rpbasic-52 programming guide, Card – Remote Processing BASIC 52 User Manual
Page 28

RPBASIC-52 PROGRAMMING GUIDE
2-9
CARD$
Syntax:
CARD $(expr)
Where : expr = 0 to 3, is the card reader to scan.
Function:
Checks c ard reader for data. If presen t, returns the site code an d card num ber. If no data is present,
an error code de scribed below is returned. All data is return ed in a string form at.
Mode:
Run
Use:
$ ( 0) = C A R D $( N )
Cards:
RPC-52, RPC-320, RPC -330
D E S C R IP T I ON
CAR D$ returns eithe r the site code and card num ber or an error code . The site code a nd card num ber is
returned in the follow ing format:
" S S S -N N N N N "
Site codes an d card num bers have lead ing 0's. The '-' character is used a s a separator.
Ther e are 4 differe nt kind s of erro r returns possib le. The se erro rs are a lway s in a 2 c harac ter "-X " form at.
'X' is a number with the following mea nings:
1
No card number present
2
H a r dw a r e e r ro r - b o th d a ta b it s do w n
3
Parity error
4
Timeout error - some data received
A "-1" return is the most common. It indicates no card was swiped. A "-3" error indicates the card was
improperly swiped.
This c omm and w as des igned to wo rk with Senso r Engi neerin g Co. (P hone 2 03 777 7444) m odel n o 3150 3.
Cards are in a 26 bit format: 2 check sum, 8 site code, 16 data.
Up to 4 card readers may be connected to the digital port at J3. Ports A and B are used to read and control the
readers. Port C m ay be used for ad ditional opto or digital I/O . Port A mus t be configured a s an input and po rt
B an output using the CONFIG LINE 100. . . statement. Port C may be input or output as required. The high
current driver, U12, must also be installed. Each card reader is connected to digital port J3 as follows:
Card Number
J3 pins
Hold
D 1
D 0
LED
0
8
21
19
10
1
6
25
23
4
2
3
22
24
1
3
7
18
20
5
The green LED on the reader may be controlled using the LINE# command. A '0' forces the LED to green
and a '1' forces it to red. A yellow LED indicates a card has been swiped and the reader is ready to send the
information.