ขอความช่วยเหลืออีกรอบครับ คือตอนนี้อาจารย์ บอกว่า โปรเจ็คผมมันตายตัวไป ก็คือมันไม่สามารถให้ผู้ใช้เปลี่ยนการ์ดเองได้ในกรณที่การ์ดใบเดิมหายไป อาจารย์ก็เลยแนะนำว่าให้แก้ใขจุดนี้
ผมก็เลยมีแนวคิดว่าจะใช้ EEPROM ในการเก็บข้อมูลรหัสบัตร 24 ใบ (อาจจะใช้ Master การ์ด ในการสั่งเปลี่ยนบัตรใบใหม่ หรือ ใช้ สวิตช์กด เพื่อสั่งเปลี่ยนบัตร ) เรื่องการใช้งาน EEPROM ผมไม่เคยเรียนมาเลยคือไม่รู้อะไรเลย
ตอนนี้ผมใช้ p0 กับ p2 แสดง 7-Segment หมายเลขบัตรแต่ละใบ 1-24 และ p 1 ใช้ควบคุม plc และ p 3.0 เป็นขารับข้อมูลจากตัวอ่าน RFID ก็จะเหลือแค่ p3.1-3.7 ที่ใช้ได้
;##############################
;# AUTOMATIC CAR PARKING #
;##############################
CPU "8051.TBL"
HOF "INT8"
ORG 0
START_POINT_BUFFER: EQU 040H
INITIAL: MOV SP,#060H
MOV TMOD,#20H
MOV SCON,#50H
MOV TH1,#0FBH
SETB TR1
MOV P0,#0C0H
MOV P2,#0C0H
MOV P1,#0FFH
;//******************//;
;//* WAIT RFID DATA *//;
;//******************//;
WAIT_DATA: MOV R0,#START_POINT_BUFFER
WAIT_DATA1: CLR RI
JNB RI,$
MOV @R0,SBUF
INC R0
CJNE R0,#START_POINT_BUFFER+14,WAIT_DATA1
;//******************//;
;//* CHECK CARD 1 *//;
;//******************//;
CHK_CARD1: MOV R0,#START_POINT_BUFFER
CJNE @R0,#02H,START_TX_ERROR ;STX=02H
MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD2 ;2
INC R0
CJNE @R0,#41H,CHK_CARD2 ;A
INC R0
CJNE @R0,#30H,CHK_CARD2 ;0
INC R0
CJNE @R0,#30H,CHK_CARD2 ;0
INC R0
CJNE @R0,#39H,CHK_CARD2 ;9
INC R0
CJNE @R0,#41H,CHK_CARD2 ;A
INC R0
CJNE @R0,#46H,CHK_CARD2 ;F
INC R0
CJNE @R0,#39H,CHK_CARD2 ;9
INC R0
CJNE @R0,#41H,CHK_CARD2 ;A
INC R0
CJNE @R0,#46H,CHK_CARD2 ;F
INC R0
CJNE @R0,#45H,CHK_CARD2 ;E
INC R0
CJNE @R0,#36H,CHK_CARD2 ;6
MOV P0,#0F9H
MOV P1,#0FEH
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
START_TX_ERROR: ACALL CLR_BUFFER
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 2 *//;
;//******************//;
CHK_CARD2: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD3 ;2
INC R0
CJNE @R0,#41H,CHK_CARD3 ;A
INC R0
CJNE @R0,#30H,CHK_CARD3 ;0
INC R0
CJNE @R0,#30H,CHK_CARD3 ;0
INC R0
CJNE @R0,#39H,CHK_CARD3 ;9
INC R0
CJNE @R0,#41H,CHK_CARD3 ;A
INC R0
CJNE @R0,#46H,CHK_CARD3 ;F
INC R0
CJNE @R0,#41H,CHK_CARD3 ;A
INC R0
CJNE @R0,#39H,CHK_CARD3 ;9
INC R0
CJNE @R0,#33H,CHK_CARD3 ;3
INC R0
CJNE @R0,#44H,CHK_CARD3 ;D
INC R0
CJNE @R0,#39H,CHK_CARD3 ;9
MOV P0,#0A4H
MOV P1,#0FDH
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 3 *//;
;//******************//;
CHK_CARD3: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD4 ;2
INC R0
CJNE @R0,#41H,CHK_CARD4 ;A
INC R0
CJNE @R0,#30H,CHK_CARD4 ;0
INC R0
CJNE @R0,#30H,CHK_CARD4 ;0
INC R0
CJNE @R0,#39H,CHK_CARD4 ;9
INC R0
CJNE @R0,#44H,CHK_CARD4 ;D
INC R0
CJNE @R0,#46H,CHK_CARD4 ;F
INC R0
CJNE @R0,#44H,CHK_CARD4 ;D
INC R0
CJNE @R0,#42H,CHK_CARD4 ;B
INC R0
CJNE @R0,#33H,CHK_CARD4 ;3
INC R0
CJNE @R0,#46H,CHK_CARD4 ;F
INC R0
CJNE @R0,#39H,CHK_CARD4 ;9
MOV P0,#0B0H
MOV P1,#0FCH
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 4 *//;
;//******************//;
CHK_CARD4: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD5 ;2
INC R0
CJNE @R0,#41H,CHK_CARD5 ;A
INC R0
CJNE @R0,#30H,CHK_CARD5 ;0
INC R0
CJNE @R0,#30H,CHK_CARD5 ;0
INC R0
CJNE @R0,#39H,CHK_CARD5 ;9
INC R0
CJNE @R0,#44H,CHK_CARD5 ;D
INC R0
CJNE @R0,#45H,CHK_CARD5 ;E
INC R0
CJNE @R0,#39H,CHK_CARD5 ;9
INC R0
CJNE @R0,#32H,CHK_CARD5 ;2
INC R0
CJNE @R0,#42H,CHK_CARD5 ;B
INC R0
CJNE @R0,#37H,CHK_CARD5 ;7
INC R0
CJNE @R0,#35H,CHK_CARD5 ;5
MOV P0,#99H
MOV P1,#0FBH
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 5 *//;
;//******************//;
CHK_CARD5: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD6 ;2
INC R0
CJNE @R0,#41H,CHK_CARD6 ;A
INC R0
CJNE @R0,#30H,CHK_CARD6 ;0
INC R0
CJNE @R0,#30H,CHK_CARD6 ;0
INC R0
CJNE @R0,#39H,CHK_CARD6 ;9
INC R0
CJNE @R0,#44H,CHK_CARD6 ;D
INC R0
CJNE @R0,#46H,CHK_CARD6 ;F
INC R0
CJNE @R0,#44H,CHK_CARD6 ;D
INC R0
CJNE @R0,#43H,CHK_CARD6 ;C
INC R0
CJNE @R0,#44H,CHK_CARD6 ;D
INC R0
CJNE @R0,#38H,CHK_CARD6 ;8
INC R0
CJNE @R0,#37H,CHK_CARD6 ;7
MOV P0,#92H
MOV P1,#0FAH
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 6 *//;
;//******************//;
CHK_CARD6: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD7 ;2
INC R0
CJNE @R0,#41H,CHK_CARD7 ;A
INC R0
CJNE @R0,#30H,CHK_CARD7 ;0
INC R0
CJNE @R0,#30H,CHK_CARD7 ;0
INC R0
CJNE @R0,#39H,CHK_CARD7 ;9
INC R0
CJNE @R0,#44H,CHK_CARD7 ;D
INC R0
CJNE @R0,#45H,CHK_CARD7 ;E
INC R0
CJNE @R0,#39H,CHK_CARD7 ;9
INC R0
CJNE @R0,#46H,CHK_CARD7 ;F
INC R0
CJNE @R0,#34H,CHK_CARD7 ;4
INC R0
CJNE @R0,#41H,CHK_CARD7 ;A
INC R0
CJNE @R0,#41H,CHK_CARD7 ;A
MOV P0,#82H
MOV P1,#0F9H
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 7 *//;
;//******************//;
CHK_CARD7: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD8 ;2
INC R0
CJNE @R0,#41H,CHK_CARD8 ;A
INC R0
CJNE @R0,#30H,CHK_CARD8 ;0
INC R0
CJNE @R0,#30H,CHK_CARD8 ;0
INC R0
CJNE @R0,#39H,CHK_CARD8 ;9
INC R0
CJNE @R0,#42H,CHK_CARD8 ;B
INC R0
CJNE @R0,#30H,CHK_CARD8 ;0
INC R0
CJNE @R0,#42H,CHK_CARD8 ;B
INC R0
CJNE @R0,#42H,CHK_CARD8 ;B
INC R0
CJNE @R0,#34H,CHK_CARD8 ;4
INC R0
CJNE @R0,#30H,CHK_CARD8 ;0
INC R0
CJNE @R0,#45H,CHK_CARD8 ;E
MOV P0,#0F8H
MOV P1,#0F8H
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 8 *//;
;//******************//;
CHK_CARD8: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD9 ;2
INC R0
CJNE @R0,#41H,CHK_CARD9 ;A
INC R0
CJNE @R0,#30H,CHK_CARD9 ;0
INC R0
CJNE @R0,#30H,CHK_CARD9 ;0
INC R0
CJNE @R0,#39H,CHK_CARD9 ;9
INC R0
CJNE @R0,#42H,CHK_CARD9 ;B
INC R0
CJNE @R0,#35H,CHK_CARD9 ;5
INC R0
CJNE @R0,#43H,CHK_CARD9 ;C
INC R0
CJNE @R0,#42H,CHK_CARD9 ;B
INC R0
CJNE @R0,#34H,CHK_CARD9 ;4
INC R0
CJNE @R0,#35H,CHK_CARD9 ;5
INC R0
CJNE @R0,#39H,CHK_CARD9 ;9
MOV P0,#80H
MOV P1,#0F7H
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 9 *//;
;//******************//;
CHK_CARD9: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD10 ;2
INC R0
CJNE @R0,#41H,CHK_CARD10 ;A
INC R0
CJNE @R0,#30H,CHK_CARD10 ;0
INC R0
CJNE @R0,#30H,CHK_CARD10 ;0
INC R0
CJNE @R0,#39H,CHK_CARD10 ;9
INC R0
CJNE @R0,#42H,CHK_CARD10 ;B
INC R0
CJNE @R0,#32H,CHK_CARD10 ;2
INC R0
CJNE @R0,#44H,CHK_CARD10 ;D
INC R0
CJNE @R0,#46H,CHK_CARD10 ;F
INC R0
CJNE @R0,#44H,CHK_CARD10 ;D
INC R0
CJNE @R0,#36H,CHK_CARD10 ;6
INC R0
CJNE @R0,#31H,CHK_CARD10 ;1
MOV P0,#90H
MOV P1,#0F6H
ACALL DELAY
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 10 *//;
;//******************//;
CHK_CARD10: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD11 ;2
INC R0
CJNE @R0,#43H,CHK_CARD11 ;C
INC R0
CJNE @R0,#30H,CHK_CARD11 ;0
INC R0
CJNE @R0,#30H,CHK_CARD11 ;0
INC R0
CJNE @R0,#34H,CHK_CARD11 ;4
INC R0
CJNE @R0,#37H,CHK_CARD11 ;7
INC R0
CJNE @R0,#42H,CHK_CARD11 ;B
INC R0
CJNE @R0,#44H,CHK_CARD11 ;D
INC R0
CJNE @R0,#39H,CHK_CARD11 ;9
INC R0
CJNE @R0,#39H,CHK_CARD11 ;9
INC R0
CJNE @R0,#34H,CHK_CARD11 ;4
INC R0
CJNE @R0,#46H,CHK_CARD11 ;F
MOV P2,#0F9H
MOV P1,#0F5H
ACALL DELAY
MOV P2,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 11 *//;
;//******************//;
CHK_CARD11: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD12 ;2
INC R0
CJNE @R0,#43H,CHK_CARD12 ;C
INC R0
CJNE @R0,#30H,CHK_CARD12 ;0
INC R0
CJNE @R0,#30H,CHK_CARD12 ;0
INC R0
CJNE @R0,#34H,CHK_CARD12 ;4
INC R0
CJNE @R0,#37H,CHK_CARD12 ;7
INC R0
CJNE @R0,#42H,CHK_CARD12 ;B
INC R0
CJNE @R0,#44H,CHK_CARD12 ;D
INC R0
CJNE @R0,#34H,CHK_CARD12 ;4
INC R0
CJNE @R0,#42H,CHK_CARD12 ;B
INC R0
CJNE @R0,#39H,CHK_CARD12 ;9
INC R0
CJNE @R0,#44H,CHK_CARD12 ;D
MOV P0,#0F9H
MOV P2,#0F9H
MOV P1,#0F4H
ACALL DELAY
MOV P0,#0C0H
MOV P2,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 12 *//;
;//******************//;
CHK_CARD12: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD13 ;2
INC R0
CJNE @R0,#43H,CHK_CARD13 ;C
INC R0
CJNE @R0,#30H,CHK_CARD13 ;0
INC R0
CJNE @R0,#30H,CHK_CARD13 ;0
INC R0
CJNE @R0,#34H,CHK_CARD13 ;4
INC R0
CJNE @R0,#37H,CHK_CARD13 ;7
INC R0
CJNE @R0,#42H,CHK_CARD13 ;B
INC R0
CJNE @R0,#44H,CHK_CARD13 ;D
INC R0
CJNE @R0,#36H,CHK_CARD13 ;6
INC R0
CJNE @R0,#35H,CHK_CARD13 ;5
INC R0
CJNE @R0,#42H,CHK_CARD13 ;B
INC R0
CJNE @R0,#33H,CHK_CARD13 ;3
MOV P2,#0F9H
MOV P0,#0A4H
MOV P1,#0F3H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 13 *//;
;//******************//;
CHK_CARD13: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD14 ;2
INC R0
CJNE @R0,#43H,CHK_CARD14 ;C
INC R0
CJNE @R0,#30H,CHK_CARD14 ;0
INC R0
CJNE @R0,#30H,CHK_CARD14 ;0
INC R0
CJNE @R0,#34H,CHK_CARD14 ;4
INC R0
CJNE @R0,#37H,CHK_CARD14 ;7
INC R0
CJNE @R0,#42H,CHK_CARD14 ;B
INC R0
CJNE @R0,#44H,CHK_CARD14 ;D
INC R0
CJNE @R0,#35H,CHK_CARD14 ;5
INC R0
CJNE @R0,#38H,CHK_CARD14 ;8
INC R0
CJNE @R0,#38H,CHK_CARD14 ;8
INC R0
CJNE @R0,#45H,CHK_CARD14 ;E
MOV P2,#0F9H
MOV P0,#0B0H
MOV P1,#0F2H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 14 *//;
;//******************//;
CHK_CARD14: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD15 ;2
INC R0
CJNE @R0,#43H,CHK_CARD15 ;C
INC R0
CJNE @R0,#30H,CHK_CARD15 ;0
INC R0
CJNE @R0,#30H,CHK_CARD15 ;0
INC R0
CJNE @R0,#34H,CHK_CARD15 ;4
INC R0
CJNE @R0,#37H,CHK_CARD15 ;7
INC R0
CJNE @R0,#42H,CHK_CARD15 ;B
INC R0
CJNE @R0,#44H,CHK_CARD15 ;D
INC R0
CJNE @R0,#38H,CHK_CARD15 ;8
INC R0
CJNE @R0,#43H,CHK_CARD15 ;C
INC R0
CJNE @R0,#35H,CHK_CARD15 ;5
INC R0
CJNE @R0,#41H,CHK_CARD15 ;A
MOV P2,#0F9H
MOV P0,#99H
MOV P1,#0F1H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 15 *//;
;//******************//;
CHK_CARD15: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD16 ;2
INC R0
CJNE @R0,#43H,CHK_CARD16 ;C
INC R0
CJNE @R0,#30H,CHK_CARD16 ;0
INC R0
CJNE @R0,#30H,CHK_CARD16 ;0
INC R0
CJNE @R0,#34H,CHK_CARD16 ;4
INC R0
CJNE @R0,#37H,CHK_CARD16 ;7
INC R0
CJNE @R0,#42H,CHK_CARD16 ;B
INC R0
CJNE @R0,#44H,CHK_CARD16 ;D
INC R0
CJNE @R0,#37H,CHK_CARD16 ;7
INC R0
CJNE @R0,#32H,CHK_CARD16 ;2
INC R0
CJNE @R0,#41H,CHK_CARD16 ;A
INC R0
CJNE @R0,#34H,CHK_CARD16 ;4
MOV P2,#0F9H
MOV P0,#92H
MOV P1,#0F0H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 16 *//;
;//******************//;
CHK_CARD16: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD17 ;2
INC R0
CJNE @R0,#43H,CHK_CARD17 ;C
INC R0
CJNE @R0,#30H,CHK_CARD17 ;0
INC R0
CJNE @R0,#30H,CHK_CARD17 ;0
INC R0
CJNE @R0,#34H,CHK_CARD17 ;4
INC R0
CJNE @R0,#37H,CHK_CARD17 ;7
INC R0
CJNE @R0,#42H,CHK_CARD17 ;B
INC R0
CJNE @R0,#44H,CHK_CARD17 ;D
INC R0
CJNE @R0,#37H,CHK_CARD17 ;7
INC R0
CJNE @R0,#46H,CHK_CARD17 ;F
INC R0
CJNE @R0,#41H,CHK_CARD17 ;A
INC R0
CJNE @R0,#39H,CHK_CARD17 ;9
MOV P2,#0F9H
MOV P0,#82H
MOV P1,#0E0H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 17 *//;
;//******************//;
CHK_CARD17: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD18 ;2
INC R0
CJNE @R0,#43H,CHK_CARD18 ;C
INC R0
CJNE @R0,#30H,CHK_CARD18 ;0
INC R0
CJNE @R0,#30H,CHK_CARD18 ;0
INC R0
CJNE @R0,#34H,CHK_CARD18 ;4
INC R0
CJNE @R0,#37H,CHK_CARD18 ;7
INC R0
CJNE @R0,#42H,CHK_CARD18 ;B
INC R0
CJNE @R0,#44H,CHK_CARD18 ;D
INC R0
CJNE @R0,#41H,CHK_CARD18 ;A
INC R0
CJNE @R0,#36H,CHK_CARD18 ;6
INC R0
CJNE @R0,#37H,CHK_CARD18 ;7
INC R0
CJNE @R0,#30H,CHK_CARD18 ;0
MOV P2,#0F9H
MOV P0,#0F8H
MOV P1,#0D0H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 18 *//;
;//******************//;
CHK_CARD18: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD19 ;2
INC R0
CJNE @R0,#43H,CHK_CARD19 ;C
INC R0
CJNE @R0,#30H,CHK_CARD19 ;0
INC R0
CJNE @R0,#30H,CHK_CARD19 ;0
INC R0
CJNE @R0,#34H,CHK_CARD19 ;4
INC R0
CJNE @R0,#37H,CHK_CARD19 ;7
INC R0
CJNE @R0,#42H,CHK_CARD19 ;B
INC R0
CJNE @R0,#39H,CHK_CARD19 ;9
INC R0
CJNE @R0,#45H,CHK_CARD19 ;E
INC R0
CJNE @R0,#35H,CHK_CARD19 ;5
INC R0
CJNE @R0,#33H,CHK_CARD19 ;3
INC R0
CJNE @R0,#37H,CHK_CARD19 ;7
MOV P2,#0F9H
MOV P0,#80H
MOV P1,#0C0H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 19 *//;
;//******************//;
CHK_CARD19: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD20 ;2
INC R0
CJNE @R0,#43H,CHK_CARD20 ;C
INC R0
CJNE @R0,#30H,CHK_CARD20 ;0
INC R0
CJNE @R0,#30H,CHK_CARD20 ;0
INC R0
CJNE @R0,#34H,CHK_CARD20 ;4
INC R0
CJNE @R0,#37H,CHK_CARD20 ;7
INC R0
CJNE @R0,#42H,CHK_CARD20 ;B
INC R0
CJNE @R0,#39H,CHK_CARD20 ;9
INC R0
CJNE @R0,#43H,CHK_CARD20 ;C
INC R0
CJNE @R0,#42H,CHK_CARD20 ;B
INC R0
CJNE @R0,#31H,CHK_CARD20 ;1
INC R0
CJNE @R0,#39H,CHK_CARD20 ;9
MOV P2,#0F9H
MOV P0,#90H
MOV P1,#0B0H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 20 *//;
;//******************//;
CHK_CARD20: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD21 ;2
INC R0
CJNE @R0,#43H,CHK_CARD21 ;C
INC R0
CJNE @R0,#30H,CHK_CARD21 ;0
INC R0
CJNE @R0,#30H,CHK_CARD21 ;0
INC R0
CJNE @R0,#34H,CHK_CARD21 ;4
INC R0
CJNE @R0,#37H,CHK_CARD21 ;7
INC R0
CJNE @R0,#42H,CHK_CARD21 ;B
INC R0
CJNE @R0,#39H,CHK_CARD21 ;9
INC R0
CJNE @R0,#46H,CHK_CARD21 ;F
INC R0
CJNE @R0,#32H,CHK_CARD21 ;2
INC R0
CJNE @R0,#32H,CHK_CARD21 ;2
INC R0
CJNE @R0,#30H,CHK_CARD21 ;0
MOV P2,#0A4H
MOV P1,#0A0H
ACALL DELAY
MOV P2,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 21 *//;
;//******************//;
CHK_CARD21: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD22 ;2
INC R0
CJNE @R0,#43H,CHK_CARD22 ;C
INC R0
CJNE @R0,#30H,CHK_CARD22 ;0
INC R0
CJNE @R0,#30H,CHK_CARD22 ;0
INC R0
CJNE @R0,#34H,CHK_CARD22 ;4
INC R0
CJNE @R0,#42H,CHK_CARD22 ;B
INC R0
CJNE @R0,#44H,CHK_CARD22 ;D
INC R0
CJNE @R0,#44H,CHK_CARD22 ;D
INC R0
CJNE @R0,#42H,CHK_CARD22 ;B
INC R0
CJNE @R0,#33H,CHK_CARD22 ;3
INC R0
CJNE @R0,#30H,CHK_CARD22 ;0
INC R0
CJNE @R0,#39H,CHK_CARD22 ;9
MOV P0,#0F9H
MOV P2,#0A4H
MOV P1,#90H
ACALL DELAY
MOV P2,#0C0H
MOV P0,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 22 *//;
;//******************//;
CHK_CARD22: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD23 ;2
INC R0
CJNE @R0,#43H,CHK_CARD23 ;C
INC R0
CJNE @R0,#30H,CHK_CARD23 ;0
INC R0
CJNE @R0,#30H,CHK_CARD23 ;0
INC R0
CJNE @R0,#34H,CHK_CARD23 ;4
INC R0
CJNE @R0,#42H,CHK_CARD23 ;B
INC R0
CJNE @R0,#44H,CHK_CARD23 ;D
INC R0
CJNE @R0,#31H,CHK_CARD23 ;1
INC R0
CJNE @R0,#33H,CHK_CARD23 ;3
INC R0
CJNE @R0,#38H,CHK_CARD23 ;8
INC R0
CJNE @R0,#38H,CHK_CARD23 ;8
INC R0
CJNE @R0,#45H,CHK_CARD23 ;E
MOV P0,#0A4H
MOV P2,#0A4H
MOV P1,#80H
ACALL DELAY
MOV P0,#0C0H
MOV P2,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 23 *//;
;//******************//;
CHK_CARD23: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,CHK_CARD24 ;2
INC R0
CJNE @R0,#43H,CHK_CARD24 ;C
INC R0
CJNE @R0,#30H,CHK_CARD24 ;0
INC R0
CJNE @R0,#30H,CHK_CARD24 ;0
INC R0
CJNE @R0,#34H,CHK_CARD24 ;4
INC R0
CJNE @R0,#42H,CHK_CARD24 ;B
INC R0
CJNE @R0,#44H,CHK_CARD24 ;D
INC R0
CJNE @R0,#31H,CHK_CARD24 ;1
INC R0
CJNE @R0,#34H,CHK_CARD24 ;4
INC R0
CJNE @R0,#33H,CHK_CARD24 ;3
INC R0
CJNE @R0,#46H,CHK_CARD24 ;F
INC R0
CJNE @R0,#35H,CHK_CARD24 ;5
MOV P0,#0B0H
MOV P2,#0A4H
MOV P1,#70H
ACALL DELAY
MOV P0,#0C0H
MOV P2,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
;//******************//;
;//* CHECK CARD 24 *//;
;//******************//;
CHK_CARD24: MOV R0,#START_POINT_BUFFER
INC R0
CJNE @R0,#32H,OUT_OF_DATA ;2
INC R0
CJNE @R0,#43H,OUT_OF_DATA ;C
INC R0
CJNE @R0,#30H,OUT_OF_DATA ;0
INC R0
CJNE @R0,#30H,OUT_OF_DATA ;0
INC R0
CJNE @R0,#34H,OUT_OF_DATA ;4
INC R0
CJNE @R0,#42H,OUT_OF_DATA ;B
INC R0
CJNE @R0,#44H,OUT_OF_DATA ;D
INC R0
CJNE @R0,#31H,OUT_OF_DATA ;1
INC R0
CJNE @R0,#36H,OUT_OF_DATA ;6
INC R0
CJNE @R0,#43H,OUT_OF_DATA ;C
INC R0
CJNE @R0,#44H,OUT_OF_DATA ;D
INC R0
CJNE @R0,#41H,OUT_OF_DATA ;A
MOV P0,#99H
MOV P2,#0A4H
MOV P1,#60H
ACALL DELAY
MOV P0,#0C0H
MOV P2,#0C0H
MOV P1,#0FFH
AJMP WAIT_DATA
OUT_OF_DATA: ACALL CLR_BUFFER
AJMP INITIAL
;//***** CLR RAM BUFFER *****//;
CLR_BUFFER: MOV R0,#START_POINT_BUFFER
CLR A
CLR_BUFFER1: MOV @R0,A
INC R0
CJNE R0,#START_POINT_BUFFER+14,CLR_BUFFER1
RET
;//***** DELAY ROUTINE *****//;
DELAY: MOV R2,#150
DEL1: MOV R3,#80
DEL2: MOV R4,#80
DJNZ R4,$
DJNZ R3,DEL2
DJNZ R2,DEL1
RET
DELAY2: MOV R4,#100
DEL4: MOV R7,#40
DEL3: MOV R6,#10
DJNZ R6,$
DJNZ R7,DEL3
DJNZ R4,DEL4
RET