📄 zygd.asm
字号:
btfss datactrl,0
goto move_arrowup
btfss datactrl,1
goto move_downarrow
return
move_arrowup
bsf displayflag,0
movf databank,f
btfss STATUS,Z
return
movlw 0x40
movwf databank
movlw 0x5
movwf optiondata
movlw 0x7b
movwf FSR
continu_up clrwdt
rrf INDF,w
rrf INDF,f
incf FSR,f
decfsz optiondata,f
goto continu_up
rrf 0x76,w
rrf 0x76,f
rrf 0x77,w
rrf 0x77,f
movlw 0xf7
subwf 0x7b,w
btfss STATUS,Z
goto EXIT_MOVE
btfss tdatactrl,2
bcf Flag1,continue_m
GOTO EXIT_MOVE
move_downarrow
bsf displayflag,0
movf databank,f
btfss STATUS,Z
GOTO EXIT_MOVE
movlw 0x40
movwf databank
movlw 0x5
movwf optiondata
movlw 0x7b
movwf FSR
continu_down
clrwdt
rlf INDF,w
rlf INDF,f
incf FSR,f
decfsz optiondata,f
goto continu_down
rlf 0x76,w
rlf 0x76,f
rlf 0x77,w
rlf 0x77,f
movlw 0xf7
subwf 0x7b,w
btfss STATUS,Z
goto EXIT_MOVE
btfss tdatactrl,2
bcf Flag1,continue_m
EXIT_MOVE
clrf PCLATH
;call mirror_data
return
;*****************************************************************
Delay70us:
movlw d'16'
movwf romcounter
Delay70us_0:
nop
decfsz romcounter,f
goto Delay70us_0 ;70us
nop
nop
nop
retlw 0
Delay100us:
movlw d'24'
movwf romcounter
Delay100us_0:
nop
decfsz romcounter,f
goto Delay100us_0 ;100us
retlw 0
Delay20us:
movlw d'4'
movwf romcounter
Delay20us_0:
nop
decfsz romcounter,f ;20us
goto Delay20us_0
nop
nop
retlw 0
;;//////////////////////////////////////////////////////////////////
Com232deal:
btfsc PORTC,Rs232Pin
retlw 0
call Delay20us
btfsc PORTC,Rs232Pin
retlw 0
bsf Flagcode,6
movlw 0x08
movwf tempb
movlw d'2'
movwf romaddress
movlw 0x50
movwf FSR
Wait_com:
btfss PORTC,Rs232Pin
goto Wait_com
goto Read232Pin
;;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;;* Read Writing EEPROM Routine
;*********************************************************************
StartBit_0:
btfsc PORTC,Rs232Pin
retlw 0
call Delay70us
btfsc PORTC,Rs232Pin
retlw 0
call Delay20us
nop
nop ;18us
nop
btfsc PORTC,Rs232Pin
retlw 0 ;93
Read232Pin_0:
call Delay100us ;102us
Read232Pin:
call Delay70us ;72us
rrf INDF,f ;175us
Predo:
btfsc PORTC,Rs232Pin ;3us
goto Detect
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
btfsc PORTC,Rs232Pin
retlw 0
nop
nop
nop
nop
nop
nop
nop
nop ;22us
nop
btfsc PORTC,Rs232Pin
retlw 0
bcf INDF,7
nop
nop
Detect_com:
decfsz tempb,f
goto Read232Pin_0
;;;;;;;;have accept one byte;;;;
Wait_high:
btfss PORTC,Rs232Pin
goto Wait_high
btfss Flagcode,6 ;judge whether 0xfe
goto Accept_Data
movlw 0xfd
subwf INDF,w
btfss Status,ZFlag
retlw 0
decfsz romaddress,f ;judge two 0xfe
goto Fist_FE
receive_encoder_data:
movlw 0x40
movwf romaddress
movlw 0x40 ;//0x10
movwf FSR
bcf Flagcode,6
WaitFirstBat:
movlw 0x08
movwf tempb
WatiFirstB
clrwdt
btfsc PORTC,Rs232Pin
goto WatiFirstB
goto StartBit_0
Fist_FE:
incf FSR,f
;bsf FSR,4
goto WaitFirstBat
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Accept_Data:
decfsz romaddress,f
goto DoDo
movlw 0x01
subwf tkeya,w
btfss Status,ZFlag
goto Write_to_eeprom
movlw 0x08
movwf tempb
WaitLo
btfsc PORTC,Rs232Pin
goto WaitLo
goto LastSelu
DoDo
incf FSR,f
;bsf FSR,4
goto WaitFirstBat
;;;///////////////////////////////////////////////
LastSelu
btfsc PORTC,Rs232Pin
retlw 0
call Delay70us
btfsc PORTC,Rs232Pin
retlw 0
call Delay20us
btfsc PORTC,Rs232Pin
retlw 0
Last232Pin_0:
call Delay100us
Last232Pin:
call Delay70us
rrf romaddress,f
Lastdo:
btfsc PORTC,Rs232Pin
goto Detect_Last
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
btfsc PORTC,Rs232Pin
retlw 0
nop
nop
nop
nop
nop
nop
nop
nop
nop
btfsc PORTC,Rs232Pin
retlw 0
bcf romaddress,7
nop
nop
Detect_Lastcom:
decfsz tempb,f
goto Last232Pin_0
;//movf key_count,w
;//xorlw 0x02
;//btfsc Status,ZFlag
goto Write_to_eeprom
;//movlw 0xfe
;//subwf romaddress,w
;//btfsc Status,ZFlag
goto Write_to_eeprom
;//retlw 0
Detect_Last:
nop
nop
nop
nop
nop
nop
nop
btfss PORTC,Rs232Pin ;;high
retlw 0
nop
nop
nop
nop
nop
nop
nop
nop
nop
btfss PORTC,Rs232Pin
retlw 0
bsf romaddress,7
goto Detect_Lastcom
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Write_to_eeprom:
movwf tempb
;movlw 0x40
movlw 0x7f ;0x10
movwf FSR
movlw 0x40
movwf tempb
movlw 0x74
;movlw 0x77
movwf romaddress
movf tkeya,w
xorlw 0x01
btfss STATUS,Z
goto Write_to_eeprom_0
movlw 0x70
;movlw 0x73
movwf romaddress
Write_to_eeprom_0:
call BStart
call Deviceadd
call Send1Byte
call Wordadd
call Send1Byte
movf INDF,w
movwf romcounter
call Send1Byte
;incf FSR,f
decf fsr,f
decf tempb,f
Wri_to_eep:
clrwdt
movf INDF,w
movwf romcounter
call Send1Byte
;incf FSR,f
decf fsr,f
decfsz tempb
goto Writ_to_eep_0
call BStop
decfsz tkeya
;//goto Wait_again_encoder
goto receive_encoder_data
nop
nop
call test_stop
clrf 0x40 ;//reset test display
clrf 0x41
clrf 0x42
clrf 0x43 ; clear line
clrf 0x44
clrf 0x45
clrf 0x46
clrf 0x47
movlw 0x03 ;set up delay timer for shift movtion
movwf timerb
clrf displayflag ; 0 ,1 ,2=start testing line
bsf displayflag,7
retlw 0
Wait_again_encoder:
clrwdt
btfsc PORTC,Rs232Pin
goto Wait_again_encoder
nop
goto receive_encoder_data
Writ_to_eep_0:
movf tempb,w
andlw 0x0f
btfss Status,ZFlag
goto Wri_to_eep
call BStop
incf romaddress
;decf romaddress
clrwdt
movlw 0x30
movwf romcounterl
Delay10ms_0:
clrwdt
movlw 0xa0
movwf romcounter
Delay10ms:
decfsz romcounter,f
goto Delay10ms
decfsz romcounterl,f
goto Delay10ms_0
goto Write_to_eeprom_0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Detect:
nop
nop
nop
nop
nop
nop
nop
nop
btfss PORTC,Rs232Pin ;;high
retlw 0
nop
nop
nop
nop
nop
nop
nop
nop
nop
btfss PORTC,Rs232Pin
retlw 0
bsf INDF,7
goto Detect_com
;***************************************************************************************
;name :wait_deal_encoder
;Function :wait the edit the encoder form 487message
;input :PORTC=0x01
;output :
;SUB :
;ram :
;*************************************************************
wait_deal_encoder:
nop
;*******************************************
movlw 0x02
movwf tkeya
;*******************************
movlw 0x05
movwf ledcounter
clrf displayflag
clrwdt
wait_487input:
nop
nop
nop
nop
btfsc PORTC,7
goto wait_deal_encoder
decfsz ledcounter
goto wait_487input
clrwdt
dealwith_487start
call Com232deal
deawith_487end
movlw 0xff
movwf keya
movwf keyb
movwf dataleft
movwf dataright
movwf datactrl
btfss displayflag,7
goto wait_487input
bsf INTCON,GIE
;*****************************************************
movlw 0x18
movwf dataleft
movlw 0x14
movwf dataright
movlw 0xff
movwf 0x6c
movwf 0x6d
movwf 0x6e
movwf 0x6f
movwf 0x70
movwf 0x7a
movwf 0x7b
movwf 0x7c
movwf 0x7d
movwf 0x7e
movlw 0x80
movwf 0x71
movlw 0xf7
movwf 0x72
movlw 0xeb
movwf 0x73
movlw 0xdd
movwf 0x74
movlw 0xbe
movwf 0x75
movwf 0x76
movwf 0x77
movwf 0x78
movlw 0xc1
movwf 0x79
movwf 0x7f
goto main
;***************************************************************************************
;-------------------------------------
ORG 0x800
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -