📄 misc.asm
字号:
;*****************************************************************
;Function:BeepLong
;Description:beep for a relatively long while(1000ms) when power-on
;input:none
;output:none
;*****************************************************************
BeepLong:
call Init_TC0
;call Delay_250ms
;call Delay_250ms
call Delay_250ms
call Delay_250ms
call Stop_TC0
ret
;*****************************************************************
;Function:BeepShort
;Description:beep for a relatively short while(100ms) when a valid command received
;input:none
;output:none
;*****************************************************************
BeepShort:
call Init_TC0
call Delay_100ms
call Stop_TC0
ret
;-------------------------------------------
Run_Speed_Hi:
OFF PIN_CTRL_MID
OFF PIN_CTRL_LO
ON PIN_CTRL_HI
;ON PIN_LED_HI ;multiplex with PIN_CTRL_HI
OFF PIN_LED_MID
OFF PIN_LED_LO
ret
;-------------------------------------------
Run_Speed_Mid:
OFF PIN_CTRL_HI
ON PIN_CTRL_LO
ON PIN_CTRL_MID
;OFF PIN_LED_HI ;multiplex with PIN_CTRL_HI
ON PIN_LED_MID
OFF PIN_LED_LO
ret
;-------------------------------------------
Run_Speed_Lo:
OFF PIN_CTRL_HI
OFF PIN_CTRL_MID
ON PIN_CTRL_LO
;OFF PIN_LED_HI ;multiplex with PIN_CTRL_HI
OFF PIN_LED_MID
ON PIN_LED_LO
ret
;-------------------------------------------
Run_Speed_None:
OFF PIN_CTRL_HI
OFF PIN_CTRL_MID
OFF PIN_CTRL_LO
;OFF PIN_LED_HI ;multiplex with PIN_CTRL_HI
OFF PIN_LED_MID
OFF PIN_LED_LO
ret
;------------------------------------------------
Lit_LED_2H:
OFF PIN_LED_4H
OFF PIN_LED_8H
ON PIN_LED_2H
ret
;------------------------------------------------
Lit_LED_4H:
OFF PIN_LED_2H
OFF PIN_LED_8H
ON PIN_LED_4H
ret
;------------------------------------------------
Lit_LED_8H:
OFF PIN_LED_4H
OFF PIN_LED_2H
ON PIN_LED_8H
ret
;------------------------------------------------
Lit_LED_None:
OFF PIN_LED_2H
OFF PIN_LED_4H
OFF PIN_LED_8H
ret
;------------------------------------------------
Lit_LED_All:
ON PIN_LED_2H
ON PIN_LED_4H
ON PIN_LED_8H
ret
;------------------------------------------------
Start_Up_Fan:
ON PIN_CTRL_MID ;run at speed middle when power on
ON PIN_CTRL_LO
ON PIN_LED_LO ;Lit LED_Lo
ret
;*****************************************************************
;Function:CE_Puls
;Description:Generate a 20us puls(to Tx data) on CE pin
;input:none
;output:none
;*****************************************************************
CE_Puls:
bset PIN_CE_nRF24L01
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
bclr PIN_CE_nRF24L01
ret
;*****************************************************************
;Function:Get_Channel
;Description:Look up the frequency agility table to get which channel to stay at.
;input:ptr_table(0~FREQ_TABLE_SIZE-1)
;output:channel
;*****************************************************************
Get_Channel:
b0mov Y, #Freq_Agil_Table$M
b0mov Z, #Freq_Agil_Table$L
mov A, #FREQ_TABLE_SIZE
cjb ptr_table, A, @F
clr ptr_table ;ptr_table>=FREQ_TABLE_SIZE,reset prt_table
@@:
mov A, ptr_table
b0add Z, A
movc
mov channel, A
ret
;*****************************************************************
;Function:Ptr_Table_Inc
;Description:ptr_table point to the next channel.
;input:ptr_table(0~FREQ_TABLE_SIZE-1)
;output:ptr_table(0~FREQ_TABLE_SIZE-1)
;*****************************************************************
Ptr_Table_Inc:
inc ptr_table
mov A, #FREQ_TABLE_SIZE
cjb ptr_table, A, @F
clr ptr_table ;ptr_table>=FREQ_TABLE_SIZE,reset prt_table
@@:
ret
;*****************************************************************
;Function:Delay_100ms
;Description:delay for 10ms.
;input:none
;output:none
;*****************************************************************
Delay_100ms:
clrwdt
movmi temp1, #100
movmi temp0, #255 ;255*4*100us=102ms
@@:
decms temp0
jmp @B
decms temp1
jmp @B
ret
;*****************************************************************
;Function:Delay_250ms
;Description:delay for 250ms.
;input:none
;output:none
;*****************************************************************
Delay_250ms:
clrwdt
movmi temp1, #255
movmi temp0, #255 ;255*4*255us=260ms
@@:
decms temp0
jmp @B
decms temp1
jmp @B
ret
;*****************************************************************
;Function:Delay_10S
;Description:delay for 10S.
;input:none
;output:none
;*****************************************************************
Delay_10S:
movmi temp2, #100
@@:
call Delay_100ms
decms temp2
jmp @B
ret
Stop_TC0:
B0BCLR FTC0ENB ;Disable TC0
B0BCLR FTC0OUT ;Disable TC0OUT (Buzzer) function.
ret
Start_TC0:
B0BSET FTC0ENB ;Enable TC0
B0BSET FTC0OUT ;Enable TC0OUT (Buzzer) function.
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -