📄 amy.asm
字号:
movlw 7
movwf indf
goto n1
qs3
movlw 12h ;18*0.5=9s
subwf xc_counter2,w
btfss status,z
goto qs4
movlw 72h
movwf fsr
movlw 1
movwf indf
goto n2
qs4
movlw 18h ;24*0.5=12s
subwf xc_counter2,w
btfss status,z
goto qs5
movlw 72h
movwf fsr
movlw 3
movwf indf
goto n2
qs5
movlw 1dh ;30*0.5=15s
subwf xc_counter2,w
btfss status,z
goto qs6
movlw 72h
movwf fsr
movlw 7
movwf indf
goto n2
qs6
movlw 24h
subwf xc_counter2,w
btfss status,z
goto qs7
movlw 71h
movwf fsr
movlw 1
movwf indf
goto dianji_ram1
qs7
movlw 2ah ;42*0.5=21s
subwf xc_counter2,w
btfss status,z
goto qs8
movlw 71h
movwf fsr
movlw 3
movwf indf
goto dianji_ram1
qs8
movlw 30h
subwf xc_counter2,w
btfss status,z
goto dianji_ram1
movlw 71h
movwf fsr
movlw 7
movwf indf
;goto dianji_ram1
dianji_ram1
bsf status,5
;; bsf status,6
goto dianji_ram
;==================================
stop
bcf porta,1
bcf porta,2
bsf portb,1
bsf portb,2 ;rn off
bsf portb,0
bsf porta,3 ;xz off
call delay_fw
call delay_fw
;; call delay_fw
stop1
bsf status,5 ;wu
;; bsf status,6 ;wu
goto init1_
;===================================
;=====================
org 600
;=====================
sx_qs1
;movlw 0
btfss flag4,xcjs_s
goto no_jindu
movlw 1
subwf xc_counter2,w ;xing zuo shang xing,
btfss status,z
goto sqs1
movlw 71h ;di yi dian liang
movwf fsr
movlw 4
movwf indf
sn1 incf fsr,f ;fsr=72
movlw 0
movwf indf
sn2 incf fsr,f ;fsr=73
movlw 0
movwf indf
goto dianji_ram
sqs1 movlw 6
subwf xc_counter2,w ;0.5s*6=3s
btfss status,z
goto sqs2
movlw 71h
movwf fsr
movlw 6
movwf indf
goto sn1
sqs2 movlw 0ch
subwf xc_counter2,w ;0.5s*12=6s
btfss status,z
goto sqs3
movlw 71h
movwf fsr
movlw 7
movwf indf
goto sn1
sqs3
movlw 12h ;18*0.5=9s
subwf xc_counter2,w
btfss status,z
goto sqs4
movlw 72h
movwf fsr
movlw 4
movwf indf
goto sn2
sqs4
movlw 18h ;24*0.5=12s
subwf xc_counter2,w
btfss status,z
goto sqs5
movlw 72h
movwf fsr
movlw 6
movwf indf
goto sn2
sqs5
movlw 1eh ;30*0.5=15s
subwf xc_counter2,w
btfss status,z
goto sqs6
movlw 72h
movwf fsr
movlw 7
movwf indf
goto sn2
sqs6
movlw 24h
subwf xc_counter2,w
btfss status,z
goto sqs7
movlw 73h
movwf fsr
movlw 4
movwf indf
goto dianji_ram
sqs7
movlw 2ah ;42*0.5=21s
subwf xc_counter2,w
btfss status,z
goto sqs8
movlw 73h
movwf fsr
movlw 6
movwf indf
goto dianji_ram
sqs8
movlw 30h
subwf xc_counter2,w
btfss status,z
goto dianji_ram;no_jindu!
movlw 73h
movwf fsr
movlw 7
movwf indf
goto dianji_ram
jindu_ram_z1
movlw 72h
movwf fsr
movlw 0
movwf indf
decf fsr,f
movwf indf ;p4~p9 off
clrf fsr
btfss flag4,z1_jis
goto no_jindu
btfsc flag3,sx
goto sx_z1
btfss flag3,xx
goto no_jindu
movlw 31h ;z1 xia xing
movwf fsr
movlw 1
subwf indf,w
btfss status,z
goto x_z1_1
movlw 73h ;z1_counter1=0
movwf fsr
movlw 1
movwf indf ;p1 on
goto dianji_ram
x_z1_1
movlw 6
subwf indf,w
btfss status,z
goto x_z1_2
movlw 73h
movwf fsr
movlw 3
movwf indf ;p1 p2 on
goto dianji_ram ;
x_z1_2
movlw 0ch
subwf indf,w
btfsc status,z
goto x_z1_21
btfss status,c
goto dianji_ram
x_z1_21 ;f31h>=0ch
movlw 73h
movwf fsr
movlw 7 ;p1 p2 p3 on
movwf indf
goto dianji_ram
sx_z1
movlw 31h
movwf fsr
movlw 1;12h
subwf indf,w
btfss status,z
goto s_z1_1
movlw 73h ;p3 on
movwf fsr
movlw 4
movwf indf
goto dianji_ram
s_z1_1
movlw 6h
subwf indf,w
btfss status,z
goto s_z1_2
movlw 73h
movwf fsr
movlw 6 ;p3 p2 on
movwf indf
goto dianji_ram
s_z1_2
movlw 0ch
subwf indf,w
btfss status,z
goto dianji_ram
movlw 73h
movwf fsr
movlw 7 ;p1 p2 p3 on
movwf indf
goto dianji_ram
jindu_ram_z2
btfss flag2,z2_ds
goto no_jindu;dianji_ram
movlw 73h
movwf fsr
movlw 0
movwf indf
movlw 71h
movwf fsr
movlw 0
movwf indf
btfsc flag3,sx
goto s_z2
btfss flag3,xx
goto no_jindu;dianji_ram
movlw 34h ;xing zuo xia xing
movwf fsr
movlw 1
subwf indf,w
btfss status,z
goto x_z2_1
movlw 72h
movwf fsr
movlw 1
movwf indf
goto dianji_ram
x_z2_1
movlw 6
subwf indf,w
btfss status,z
goto x_z2_2
movlw 72h
movwf fsr
movlw 3
movwf indf
goto dianji_ram
x_z2_2
movlw 0ah
subwf indf,w
btfss status,z
goto dianji_ram
movlw 72h
movwf fsr
movlw 7
movwf indf
goto dianji_ram
s_z2
movlw 34h
movwf fsr
movlw 1
subwf indf,w
btfss status,z
goto s_z2_1
movlw 72h
movwf fsr
movlw 4
movwf indf
goto dianji_ram
s_z2_1
movlw 6
subwf indf,w
btfss status,z
goto s_z2_2
movlw 72h
movwf fsr
movlw 6
movwf indf
goto dianji_ram
s_z2_2
movlw 0ah
subwf indf,w
btfss status,z
goto dianji_ram
movlw 72h
movwf fsr
movlw 7
movwf indf
goto dianji_ram
jindu_ram_z3
movlw 73h
movwf fsr
movlw 0
movwf indf
decf fsr,f
movwf indf
clrf fsr
btfss flag6,z3_jis
goto no_jindu
btfsc flag3,sx
goto s_z3
btfss flag3,xx
goto no_jindu;dianji_ram
movlw 36h ;xia xing
movwf fsr
movlw 1h
subwf indf,w
btfss status,z
goto x_z3_1
movlw 71h
movwf fsr
movlw 1 ;p7 on
movwf indf
goto dianji_ram
x_z3_1
movlw 6h
subwf indf,w
btfss status,z
goto x_z3_2
movlw 71h
movwf fsr
movlw 3
movwf indf
goto dianji_ram
x_z3_2 movlw 0ch
subwf indf,w
btfss status,z
goto dianji_ram
movlw 71h
movwf fsr
movlw 7
movwf indf
goto dianji_ram
s_z3
movlw 36h ;shang xing
movwf fsr
movlw 1
subwf indf,w
btfss status,z
goto s_z3_1
movlw 71h
movwf fsr
movlw 4
movwf indf
goto dianji_ram
s_z3_1
movlw 6
subwf indf,w
btfss status,z
goto s_z3_2
movlw 71h
movwf fsr
movlw 6
movwf indf
goto dianji_ram
s_z3_2
movlw 0ah
subwf indf,w
btfss status,z
goto dianji_ram
movlw 71h
movwf fsr
movlw 7
movwf indf
goto dianji_ram
;-----
jindu_ram_self
goto dianji_ram
no_jindu ;xing zuo ting ji
movlw 71h
movwf fsr
movlw 0
movwf indf
incf fsr,f
movwf indf
incf fsr,f
movwf indf
goto dianji_ram
;---------------------------------
dianji_ram
movlw 70h
movwf fsr
btfsc flag2,datui
bsf indf,0
btfss flag2,datui
bcf indf,0
btfsc flag2,xiaotui
bsf indf,1
btfss flag2,xiaotui
bcf indf,1
btfsc flag2,auto
bsf indf,2
btfss flag2,auto
bcf indf,2
;*****************************
turn bcf status,5
bcf status,6
goto start
;*****************************
initfw
movlw 9 ;programmer start
movwf porta
movlw 7
movwf portb
movlw 1
movwf portc
movlw 0
tris porta
movlw 0f8h ;wuuuuuu
tris portb
movlw 0f0h
tris portc
movlw 9
movwf porta
movlw 7
movwf portb
movlw 1
movwf portc
movlw 6
option ;1:128,rtcc counter
goto init1_
;-----------------------------------------
init1 ;fu wei cheng xu
clrf temp1
clrf temp2
movlw d'5'
movwf a_timer
init1_1
clrwdt
decfsz temp1,f
goto init1_2
decfsz temp2,f
goto init1_2
decfsz a_timer,f
goto init1_2
goto init2
init1_2 btfss portb,6
goto init2 ;rou nie wei yu kuan wei
bcf portb,2
;; bsf portb,1
goto init1_1
init2 bsf portb,2
init3
clrwdt
btfsc portb,3
goto init4 ;xing zuo wei yu shang xian
bcf portb,0
;; bsf porta,3
goto init3
init4
bsf portb,0
;; bsf porta,3
;wu clear from XCKG
bcf status,5
;; bsf status,6
call delay_fw
call delay_fw
;; bsf portb,0
bcf porta,3
call delay_fw
call delay_fw
call delay_fw
bsf status,5
;; bsf status,6
;; bsf portb,0
bsf porta,3
movlw 0f8h
movwf rtcc
bcf status,5
bcf status,6
goto start
;---------------------------------------
init1_ ;wu
clrf fsr
movlw 80h
movwf flag1
clrf flag2
clrf flag3
clrf flag4
clrf flag6
movlw 41h ;bei_guang liang, kuan
movwf flag5
clrf flag7
movlw 0ah ;wu 6h
movwf counter_20ms
movwf end_key_counter
movlw d'80'
movwf t200ms
movlw beig_counter
movwf fsr
movlw d'90'
movwf indf
clrf fsr
movlw d'200' ;32h
movwf xhx_counter
movlw d'200' ;64h
movwf rhx_counter
movlw T500MS ;wu 6ah
movwf xc_counter1
clrf xc_counter2
clrf key_buffer
clrf send_num
movlw 0f9h
movwf ds_counter1
clrf ds_counter2
clrf qujian
movlw b'00001000' ;3
movwf mode
bcf fsr,6
bsf fsr,5
bsf fsr,4
clrf 30h; z1_counter1
clrf 31h; z1_counter2
clrf 32h; self_define
clrf 33h
clrf 34h
clrf 35h
clrf 36h
clrf fsr
;--------------------------------------------
bcf porta,0 ;wu beiguang liang
;lcd initalize
movlw 79 ;lcd all on
movwf fsr
movlw 0f
next1
btfss fsr,4 ;end 0f 70
goto ret3;lcd_upd
movwf 0 ;wu improve
decf fsr,1
goto next1
;--------------------------------------------
ret3
movlw 78h
movwf fsr
movlw 01
movwf indf ;kill display self-area
;"lcd on" command 100 0+000 0011x
clrf fsr
bsf status,5
bcf status,6
movlw 80; command
movwf temp1
bcf flag1,finish
movlw 04
movwf send_num
call spi_send
movlw 06;
movwf temp1
bcf flag1,finish
movlw 08
movwf send_num
call spi_send
clrf fsr
movlw 0; command sys en 0000 + 0001x
movwf temp1
bcf flag1,finish
movlw 04
movwf send_num
call spi_send
movlw 10; command
movwf temp1
bcf flag1,finish
movlw 05
movwf send_num
call spi_send
clrf fsr
movlw 10; command rc 256k: 0001 + 10xxx
movwf temp1
bcf flag1,finish
movlw 04
movwf send_num
call spi_send
movlw 80; command
movwf temp1
bcf flag1,finish
movlw 05
movwf send_num
call spi_send
clrf fsr
movlw 20; command bias1/3 4comms:0010+ ab(10)x1x
movwf temp1
bcf flag1,finish
movlw 04
movwf send_num
call spi_send
movlw 90; command
movwf temp1
bsf flag1,finish
movlw 05
movwf send_num
call spi_send
;------------------------------------------
;wu
bsf flag7,lcd_init
bcf status,5
bcf status,6
goto lcd_upd
ret4
bsf status,5
bsf status,6
goto init1
;===============================
over org 7ffh
goto init
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -