📄 keyboard.asm
字号:
ldi counter1,11
wdr
rcall comm_uart_send
ret
/*--------------------------------------------------------*/
send_find_card:
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi temp,0xaa
st Z+,temp
st Z+,temp
st Z+,temp
ldi temp,0x96
st Z+,temp
ldi temp,0x69
st Z+,temp
ldi temp,0x00
st Z+,temp
ldi temp,0x03
st Z+,temp
ldi temp,0x20
st Z+,temp
ldi temp,0x01
st Z+,temp
ldi temp,0x22
st Z+,temp
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi counter1,10
wdr
rcall comm_uart_send
ret
;==========================================================
send_select_card:
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi temp,0xaa
st Z+,temp
st Z+,temp
st Z+,temp
ldi temp,0x96
st Z+,temp
ldi temp,0x69
st Z+,temp
ldi temp,0x00
st Z+,temp
ldi temp,0x03
st Z+,temp
ldi temp,0x20
st Z+,temp
ldi temp,0x02
st Z+,temp
ldi temp,0x21
st Z+,temp
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi counter1,10
wdr
rcall comm_uart_send
ret
;====================================================
send_read_base:
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi temp,0xaa
st Z+,temp
st Z+,temp
st Z+,temp
ldi temp,0x96
st Z+,temp
ldi temp,0x69
st Z+,temp
ldi temp,0x00
st Z+,temp
ldi temp,0x03
st Z+,temp
ldi temp,0x30
st Z+,temp
ldi temp,0x01
st Z+,temp
ldi temp,0x32
st Z+,temp
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi counter1,10
wdr
rcall comm_uart_send
ret
delay_200ms:
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ret
;===========================================
send_key_ack:
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,'o'
rcall send_key_common_ascii
ldi temp1,'k'
rcall send_key_common_ascii
wdr
ret
send_key_nack:
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,10
rcall delay_mS
wdr
ldi temp1,'n'
rcall send_key_common_ascii
ldi temp1,'o'
rcall send_key_common_ascii
wdr
ret
;===========================================
send_key_image:
;need no more release time&release key for auto,and key_in_on release befor send_key_image
ldi eeprom_addrl,KEY_SKIP
clr eeprom_addrh
rcall read_eeprom
mov counter2,eeprom_data ;load skip
rcall send_key_name
rcall send_key_skip
rcall send_key_sex
rcall send_key_skip
rcall send_key_nation
rcall send_key_skip
rcall send_key_birth
rcall send_key_skip
rcall send_key_address
rcall send_key_skip
rcall send_key_id
rcall send_key_skip
rcall send_key_issue
rcall send_key_skip
rcall send_key_exper
rcall send_key_skip
rcall send_key_exper2
rcall turn_on_key
wdr
ret
;--------------------------------------
send_key_skip:
wdr
mov temp1, key_delay
rcall delay_mS
wdr
mov key_value,counter2
rcall send_key_to_pc
mov temp1, key_delay
rcall delay_mS
wdr
ldi temp1,0xf0
mov key_value,temp1
rcall send_key_to_pc
mov temp1, key_delay
rcall delay_mS
wdr
mov key_value,R0
rcall send_key_to_pc
wdr
ret
;-----------------------------------------------
send_key_common_ascii:
;input: temp1
ldi ZH,high(key_table_ascii)
ldi ZL,low(key_table_ascii)
check_ascii_loop:
lpm
cp temp1,R0
breq goto_ascii_ret
adiw ZL,0x02
rjmp check_ascii_loop
goto_ascii_ret:
adiw ZL,0x01
lpm
mov temp1, key_delay
rcall delay_mS
wdr
mov key_value,R0
rcall send_key_to_pc
mov temp1, key_delay
rcall delay_mS
wdr
ldi temp1,0xf0
mov key_value,temp1
rcall send_key_to_pc
mov temp1, key_delay
rcall delay_mS
wdr
mov key_value,R0
rcall send_key_to_pc
ret
;input:temp1
send_key_common_hex_byte:
wdr
ldi ZL,low(key_table_hex)
ldi ZH,high(key_table_hex)
clc
add ZL,temp1
adc ZH,zero_register
lpm
mov temp1, key_delay
rcall delay_mS
wdr
mov key_value,R0
rcall send_key_to_pc
mov temp1, key_delay
rcall delay_mS
wdr
ldi temp1,0xf0
mov key_value,temp1
rcall send_key_to_pc
mov temp1, key_delay
rcall delay_mS
wdr
mov key_value,R0
rcall send_key_to_pc
wdr
ret
;----------------------------------
;input:Y,table of value want to send
; :counter1
send_key_common_hex:
; wdr
; ldi temp1,3
; rcall delay_mS
; wdr
; rcall delay_200ms
; rcall delay_200ms
; rcall shut_off_key
; cli
; rcall send_break_key ;add 2006 9 19 for release key
send_key_common_hex_start:
wdr
ld unicode_low,Y+ ;LOW IN TABLE
ld unicode_high,Y+
;check asccii or gbk
cpse unicode_high,zero_register
rjmp check_gbk
cpi unicode_low,0x80
brsh check_gbk
rcall turn_off_gbk
mov temp1,unicode_low
rcall send_key_common_ascii
dec counter1
dec counter1
brne send_key_common_hex_start
rjmp send_key_hex_ret
check_gbk:
rcall check_unicode_gbk ;Z
;here, ctrl+f9 must be send for gbk input
rcall turn_on_gbk
; mov temp,unicode_high for dec input
; rcall mod_10
; mov temp1,key_bit_count ;%
; rcall send_key_common_hex_byte
; mov temp1,temp ;/
; rcall send_key_common_hex_byte
; mov temp,unicode_low
; rcall mod_10
; mov temp1,key_bit_count ;%
; rcall send_key_common_hex_byte
; mov temp1,temp ;/
; rcall send_key_common_hex_byte
mov temp1,unicode_high ;for hex input
swap temp1
andi temp1,0x0f
rcall send_key_common_hex_byte ;Z
mov temp1,unicode_high
andi temp1,0x0f
rcall send_key_common_hex_byte ;Z
mov temp1,unicode_low
swap temp1
andi temp1,0x0f
rcall send_key_common_hex_byte
mov temp1,unicode_low
andi temp1,0x0f
rcall send_key_common_hex_byte
dec counter1
dec counter1
brne send_key_common_hex_start
;here,must shut off gbk input
rcall turn_off_gbk
/******* for test send HEX and space and enter *********
mov temp1,temp
cpi temp,
swap temp1
andi temp1,0x0f
rcall send_key_common_hex_byte
mov temp1,temp
andi temp1,0x0f
rcall send_key_common_hex_byte
wdr
ldi temp1,3
rcall delay_mS
wdr
ldi temp1,0x10 ;space
rcall send_key_common_hex_byte
wdr
ldi temp1,3
rcall delay_mS
wdr
mov temp1,counter1
andi temp1,0x1f
cpi temp1,0x00
brne next_hex_key_to_send
ldi temp1,0x11 ;enter
rcall send_key_common_hex_byte
wdr
ldi temp1,3
rcall delay_mS
wdr
next_hex_key_to_send:
dec counter1
brne 3_start
ldi temp1,0x11 ;enter
rcall send_key_common_hex_byte*/
send_key_hex_ret:
; rcall turn_on_key FOR ONE_KEY
sei
ret
;------------------
send_key_name:
wdr
ldi YL,usb_buffer_low
ldi YH,usb_buffer_high
ldi temp,name_addr_offset
clc
add YL,temp
adc YH,zero_register
ldi counter1,name_length
rcall send_key_common_hex
ret
;----------------------------------
send_key_sex:
wdr
ldi YL,folk_buffer_low
ldi YH,folk_buffer_high
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi temp,sex_addr_offset
clc
add ZL,temp
adc ZH,zero_register
ld temp,Z
cpi temp,0x31 ;unicode 3775
breq goto_man
ldi temp,0x73
st Y+,temp
ldi temp,0x59
st Y+,temp
rjmp send_key_sex_unicode
goto_man:
ldi temp,0x37
st Y+,temp
ldi temp,0x75
st Y+,temp
send_key_sex_unicode:
ldi YL,folk_buffer_low
ldi YH,folk_buffer_high
ldi counter1,2 ;sex_length
rcall send_key_common_hex
ret
;------------------------------------------
send_key_nation:
push send_bit_delay
wdr
ldi ZL,usb_buffer_low
ldi ZH,usb_buffer_high
ldi temp,nation_addr_offset
clc
add ZL,temp
adc ZH,zero_register
ld temp,Z+ ;first low
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -