📄 black_plane-tx-v2.37.asm
字号:
jmp RF_TX_code_start10
; b0bset code_current_data_ok
; jmp RF_TX90
b0bset code_start ; the start code is transmitted ok
; jmp RF_TX_code_head
RF_TX_code_start10:
mov a,#1
mov low_times,a ; set the time of the low level continue 280us
jmp RF_TX90
RF_TX_code_head:
mov a,#9
mov low_times,a ; set the time of the low level continue 2.5ms
; b0bset code_current_data_ok
mov a,#4
mov data_length,a ; the next data length
; jmp RF_TX90
b0bset code_head
jmp RF_TX90
; jmp RF_TX_code_sycn
RF_TX_code_sycn:
decms data_length
jmp RF_TX_code_sycn10
mov a,#1
mov low_times,a ; set the time of the low level continue 280us,transmitting 0
; b0bset code_current_data_ok
mov a,#8
mov data_length,a ; the next data length
b0bset code_sycn
jmp RF_TX90
; jmp RF_TX_code_data
RF_TX_code_sycn10:
mov a,#3
mov low_times,a ; set the time of the low level continue 840us,transmitting 1
jmp RF_TX90
RF_TX_code_data:
decms data_length
jmp RF_TX_code_data10
mov a,#1
rlcm txdata ; transmitting the last bit
b0bts0 fc
mov a,#3
mov low_times,a
b0bset code_data
jmp RF_TX90
; b0bset code_current_data_ok
b0bset code_all_data_ok
mov a,#2
mov data_length,a ; the next data length
; jmp RF_TX90
jmp RF_TX_code_wait30ms
RF_TX_code_data10:
mov a,#1 ; set the time of the low level continue 280us,TX 0
rlcm txdata
b0bts0 fc
mov a,#3 ; set the time of the low level continue 840us,TX 1
mov low_times,a
jmp RF_TX90
RF_TX_code_wait30ms:
b0bset before
mov a,#108 ; waiting for 30ms
mov low_times,a
mov a,#2
mov data_length,a ; the next data length
b0bclr code_start
b0bclr code_head
b0bclr code_sycn
b0bclr code_data
clr txdata
b0bset code_all_data_ok
RF_TX90:
ret
;---------------------------------------------------------------------------------
;---------------------------------------------------------------------------------
Mntime_count:
b0bts1 time50ms_ok ; the 50ms is coming
jmp time_count90
b0bclr time50ms_ok
incms time500ms
cja_ time500ms,#10,flash_led
@@: incms time4s
nop
b0bts0 p2buf.3 ; added on 2004/10/20
b0bset LEDbuf.4
cja_ time4s,#100,sleep_mode ; check the time that no key pressed 200->100///2004/10/16
b0bts1 charge_start
jmp time_count90
incms times4
cja_ times4,#200,stop_charge ; detect the charge time
jmp time_count90
;///////////////////////////////////////////////////////
flash_led:
clr time500ms
b0bts1 RED_flash_enable ; when flash is enable,will flash LED with 0.5Hz frequency
jmp @b
b0bts1 LED_on
jmp flash_led_on
b0bclr LED_on
b0bclr LEDbuf.7
jmp @b
flash_led_on:
b0bset LED_on
b0bset LEDbuf.7
jmp @b
;///////////////////////////////////////////
stop_charge:
clr times4
incms charge_time
nop
cja_ charge_time,#24,to_stop_charge
jmp time_count90
; mov a,#24
; mov charge_time,a
to_stop_charge:
clr charge_time
b0bclr LEDbuf.2
b0bset LEDbuf.6 ;/////////////////////
b0bclr LEDbuf.7
b0bclr RED_flash_enable
b0bset charge_ok
jmp time_count90
;/////////////////////////////////////////////
sleep_mode:
clr time4s
mov a,#180 ; 24->48/////////2004/10/16 48-->180///////////////2004/11/06
b0bts0 detect_led_on
mov sleep_time,a
incms sleep_time
nop
cja_ sleep_time,#180,to_sleep ; 24->48/////////2004/10/16 ; if it's detect mode ,will goto sleep mode with no key pressed after 10 second
; 48-->180///////////////2004/11/06
jmp time_count90
to_sleep:
b0bclr detect_led_on
; mov a,#24
; mov sleep_time,a
clr sleep_time
clr time4s
b0bclr p2buf.4
b0bclr p2buf.6
b0bset fcpum0 ; set the ic body to sleep mode
nop
b0bts0 p2buf.3 ; //////////added on 2004/10/20
jmp Reset
b0bts0 p0buf.0 ; //////////added on 2004/10/20
jmp to_sleep ; //////////added on 2004/10/20
b0bts1 p2buf.1 ; //////////added on 2004/10/20
jmp Reset ; //////////added on 2004/10/20
jmp to_sleep ; //////////added on 2004/10/20
;?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
time_count90:
ret
;-----------------------------------------------------------------------------
MnLED:
; b0bset LEDbuf.0
; b0bts1 p2buf.5
; b0bclr LEDbuf.0
; mov a,LEDbuf
b0bts1 LEDbuf.2
jmp led10
b0bset p2buf.2 ; charge,
jmp @f
led10:
b0bclr p2buf.2 ; stop charge ,turn off charge indicator
@@:
b0bts1 LEDbuf.4 ; turn on/off sleep mode indicator
jmp led20
b0bset p2buf.4
jmp @f
led20:
b0bclr p2buf.4
@@:
b0bts1 LEDbuf.6 ;turn on/off low power indicator
jmp led30
b0bset p2buf.6
jmp @f
led30:
b0bclr p2buf.6
@@:
b0bts1 LEDbuf.7 ; turn on/off charge indicator
jmp led40
b0bset p2buf.7
jmp @f
led40:
b0bclr p2buf.7
@@:
; mov p2buf,a
;????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
ret
;-----------------------------------------------------------------------------
; Isr (Interrupt Service Routine)
; Arguments :
; Returns :
; Reg Change:
;-------------------------------------------------------------------------------
Isr:
;-----------------------------------
; Save ACC
;-----------------------------------
b0xch A,AccBuf ;B0xch instruction do not change C,Z flag
b0mov A,PFLAG
b0mov PflagBuf,A
;-----------------------------------
; Interrupt service routine
;-----------------------------------
INTP00CHK: ; Check INT0 interrupt request
B0BTS1 FP00IEN ; Check P00IEN
JMP INTTC0CHK ; Jump check to next interrupt
B0BTS0 FP00IRQ ; Check P00IRQ
JMP INTP00 ; Jump to INT0 interrupt service routine
INTTC0CHK: ; Check TC0 interrupt request
B0BTS1 FTC0IEN ; Check TC0IEN
JMP INT_EXIT ; Jump to exit of IRQ
B0BTS0 FTC0IRQ ; Check TC0IRQ
JMP INTTC0 ; Jump to TC0 interrupt service routine
;-----------------------------------
; Exit interrupt service routine
;-----------------------------------
INT_EXIT:
b0mov A, PflagBuf
b0mov PFLAG, A ;Restore the PFlag
b0xch A,AccBuf ;Restore the Reg. A
;B0xch instruction do not change C,Z flag
reti ;Exit the interrupt routine
;-------------------------------------------------------------------------------
; INT0 interrupt service routine
;-------------------------------------------------------------------------------
INTP00:
b0bclr FP00IRQ
;Process P0.0 external interrupt here
jmp INT_EXIT
;-------------------------------------------------------------------------------
; TC0 interrupt service routine
;-------------------------------------------------------------------------------
INTTC0:
b0bclr FTC0IRQ
mov a,#138 ; set interrupt interval 280us
mov tc0c,a
; detect the interrupt interval time
; b0bts1 detect_led_on
; jmp detect_led_off
; b0bclr detect_led_on
; b0bclr p2buf.7
; jmp d2
;detect_led_off:
; b0bset detect_led_on
; b0bset p2buf.7
;d2:
;
decms time50ms
jmp inttc010
b0bset time50ms_ok
mov a,#179
mov time50ms,a
inttc010:
mov a,#0
cmprs a,txdata
jmp @f
jmp tx111
@@:
b0bts1 TX_enable
jmp inttc090 ; disable TX
; b0bts0 key_value.7
; jmp RF_TX10 ;反相
b0bts0 p2buf.0
jmp tx111
; jmp RF_TX20 ;正相
RF_TX10:
b0bts1 before
jmp TX11
b0bset p2buf.5
decms low_times ;反相
jmp inttc090
b0bset bitok
b0bclr before
jmp inttc090
TX11:
b0bclr p2buf.5
b0bset before
jmp inttc090
TX111:
b0bset code_all_data_ok
b0bclr p2buf.5
; b0bset before
jmp inttc090
;++++++++++++++++++++++++++++++++++++++++++++++++++++++
RF_TX20:
b0bts1 before
jmp TX21
b0bclr p2buf.5
decms low_times ;正相
jmp inttc090
b0bset bitok
b0bclr before
jmp inttc090
TX21:
b0bset p2buf.5
b0bset before
inttc090:
jmp INT_EXIT
;-------------------------------------------------------------------------------
; SysInit
; System initial to define Register, RAM, I/O, Timer......
;-------------------------------------------------------------------------------
SysInit:
mov a,#07h
mov pur,a ; enable p1,p2,p0 pull-up register
mov a,#00h
mov p1mbuf,a ; set port1 to be input mode
;
mov a,#00010000B
mov p2buf,a
mov a,#11110100B ; set p2.5,p2.3,p2.1 to be input mode,other to be output mode
mov p2mbuf,a
;
mov a,#2
mov data_length,a
mov a,#1
mov low_times,a
mov a,#179
mov time50ms,a
; mov a,#24
; mov sleep_time,a
; mov charge_time,a
mov a,#00001111b
b0mov p1w,a ;Enable P1.0 P1.1 P1.2 P1.3 wakeup function
settc0:
b0bclr ftc0ien
b0bclr ftc0enb
mov a,#70h
mov tc0m,a ; set tc0 clock is Fcpu/2
mov a,#130 ; set interrupt interval 280us
mov tc0c,a
b0bset ftc0ien
b0bclr ftc0irq
b0bset ftc0enb
ret
;-------------------------------------------------------------------------------
; ClrRAM
; Use index @YZ to clear RAM (00h~2Fh)
;-------------------------------------------------------------------------------
ClrRAM:
clr Y
b0mov Z,#0x2f ;Set @YZ address from 2fh
ClrRAM10:
clr @YZ ;Clear @YZ content
decms Z ;z = z - 1 , skip next if z=0
jmp ClrRAM10
clr @YZ ;Clear address $00
ret
;-------------------------------------------------------------------------------
ENDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -