關于非接觸式IC智能(射頻)卡及其讀寫設備內核技術的研究與應用開發(連載11)
文章出處:http://5052h112.com 作者:張敏 人氣: 發表時間:2011年11月01日
;---------------------SEND THE 1st line 0 -----------------------
kb_look_pad:
;ACALL INIT_DISP_BUF
MOV R7,#20H
LCALL D500US
MOV A,#11111110B
;CLR P1.0 ;SEND THE 1st line 0
mov p1,a
CLR P2.0 ;enable kb func.
setb c ;set : c=1
mov c,p1.4 ;if 1 pressed, then p1.4=0,then c=0
jnc kb_1_find
mov c,p1.5 ;if 2 pressed, then p1.5=0,then c=0
jnc kb_2_find
mov c,p1.6 ;if 3 pressed, then p1.6=0,then c=0
jnc kb_3_find
mov c,p1.7 ;if 2nd pressed, then p1.7=0,then c=0
jnc kb_2nd_find
clr c
;---------------------SEND THE 2nd line 0 -----------------------
MOV A,#11111101B
;CLR P1.1 ;SEND THE 2nd line 0
mov p1,a
CLR P2.0 ;enable kb func.
setb c ;set : c=1
mov c,p1.4 ;if 4 pressed, then p1.4=0,then c=0
jnc kb_4_find
mov c,p1.5 ;if 5 pressed, then p1.5=0,then c=0
jnc kb_5_find
mov c,p1.6 ;if 6 pressed, then p1.6=0,then c=0
jnc kb_6_find
mov c,p1.7 ;if READ pressed, then p1.7=0,then c=0
jnc kb_read_find
clr c
;---------------------SEND THE 4th line 0 -----------------------
MOV A,#11110111B
;CLR P1.0 ;SEND THE 4th line 0
mov p1,a
CLR P2.0 ;enable kb func.
setb c ;set : c=1
mov c,p1.4 ;if . pressed, then p1.4=0,then c=0
jnc kb_dot_find
mov c,p1.5 ;if 0 pressed, then p1.5=0,then c=0
jnc kb_0_find
mov c,p1.6 ;if REQUEST pressed, then p1.6=0,then c=0
jnc kb_request_find
mov c,p1.7 ;if EXE C pressed, then p1.7=0,then c=0
jnc kb_exe c_find
clr c
RET
;----------------------------------------------------------------
kb_dot_find:ljmp kb_dot_find_1 ;relay for instr.”jnc”
kb_0_find: ljmp kb_0_find_1
kb_request_find:ljmp kb_request_find_1
kb_exe c_find: ljmp kb_exe c_find_1
kb_2nd_find:ljmp kb_2nd_find_1
kb_read_find:ljmp kb_read_find_1
kb_write_find:ljmp kb_write_find_1
kb_1_find:ljmp kb_1_find_1
kb_2_find:ljmp kb_2_find_1
kb_3_find:ljmp kb_3_find_1
kb_4_find:ljmp kb_4_find_1
kb_5_find:ljmp kb_5_find_1
kb_6_find:ljmp kb_6_find_1
kb_7_find:ljmp kb_7_find_1
kb_8_find:ljmp kb_8_find_1
kb_9_find:ljmp kb_9_find_1
;------------------------- kb_x_find, process--------------------
kb_1_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#01H
ret
;--------------------------------
kb_2_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#02h
ret
;--------------------------------
kb_3_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#03h
ret
;--------------------------------
kb_2nd_find_1: ;clear the current 8_LED display_value with “00”
LCALL INIT_DISP_BUF
;ACALL DISPLAY
;ACALL H_DISPLAY
;LCALL DISP_BUF_right_MOVE
;MOV 3AH,#0ah
ret
;--------------------------------
kb_4_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#04h
ret
;--------------------------------
kb_5_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#05h
ret
;--------------------------------
kb_6_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#06h
ret
;--------------------------------
kb_7_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#07h
ret
;--------------------------------
kb_8_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#08h
ret
;--------------------------------
kb_9_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#09h
ret
;--------------------------------
kb_0_find_1:
LCALL DISP_BUF_right_MOVE
MOV 3AH,#00h
ret
;--------------------------------
kb_write_find_1:
ret
;--------------------------------
kb_dot_find_1:
MOV 3AH,#03h
mov 39h,#01h
ret
;--------------------------------
kb_request_find_1:
MOV 3AH,#05h
mov 39h,#01h
ret
;--------------------------------
kb_exe c_find_1:
MOV 3AH,#06h
mov 39h,#01h
ljmp kb_all_exit
ret
;--------------------------------
kb_read_find_1:
MOV a,39H
ANL A,#00001111B
SWAP A
MOV R1,A
mov A,3Ah
ANL A,#00001111B
ADD A,R1
;------------ NOW COMPARE THE EXACT BLOCK NUMBER ------------
;----------------- the 00h sector --------------------
COMPARE_00:
CJNE A,#00H,COMPARE_01
lcall sector_00_common
MOV 78h,#00h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_01:
CJNE A,#01H,COMPARE_02
lcall sector_00_common
MOV 78h,#01h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_02:
CJNE A,#02H,COMPARE_03
lcall sector_00_common
MOV 78h,#02h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_03: CJNE A,#03H,COMPARE_04
lcall sector_00_common
MOV 78h,#03h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
(待續)