PDA

View Full Version : Smart card reader with PIC16F84A



bangunprayogi
- 12th August 2005, 11:36
Hi every body...
I just need a help about Pic to Pic communication (both are PIC16F84A), such as a smart card and the reader interfacing. This can be modeled as a master and slave communication, that the card as a slave and the reader as a master. I use the system for access purpose...some can be explained as follow: The card have code (for example 13201150, I want this code as data string ) and the reader have to read some range code (for example 13201150 until 13201155 and I want this code as string too), so if card have not code in that range the reader will not read the code in card. In reader data will be stored in serial external EEPROM with I2C connection, read back, display on LCD and send to PC. In Card I use this script:
.....
.....
MAIN:
SEROUT2 SO,BAUD,["13201150"] 'send access code :)
PAUSE 400
GoTo MAIN

End
And in reader I want to use this script:
MAIN:
SERin2 PORTA.0,396,[wait("13201150", "13201151", "13201152", "13201153", "13201154", "13201155"),B3]
goto Code_OK1
GOTO MAIN
...................This code can't run, I think there is problem on serin2 command although there is not a error when I compile it ..................................

But, the system is work if I use this script in card:
MAIN:
SEROUT2 SO,BAUD,[150] 'send access code :)
PAUSE 400
GoTo MAIN

End
And in reader I use this script:
MAIN:
SERin2 PORTA.0,396,[wait(150),B3]
goto Code_OK1
GOTO MAIN
Code_OK1:
Pause 500 ' Wait for LCD to startup
address = 0
I2CWrite SDA,SCL,$A0,address,[B3]
loop1: address = 0
I2CRead SDA,SCL,$A0,address,[B2]
Lcdout $fe, 1
Lcdout "13201",#B2
SERout PORTA.3,0,["13201",#B2,10,13]
Pause 500
GoTO loop1
END
.....................But this code is not the specification I want........................
.....................I must place data in external EEPROM manually??.................
Anyone can help me...??