Files

1084 lines
24 KiB
NASM

;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 4.2.0 #13081 (Linux)
;--------------------------------------------------------
.module main
.optsdcc -mmcs51 --model-small
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _main
.globl _ms_tick_isr
.globl _model_get_mode
.globl _model_init
.globl _cmd_poll
.globl _sbus_make_uart_frame
.globl _sbus_unpack_channels
.globl _nrf24_write_ack_payload
.globl _nrf24_data_ready
.globl _nrf24_set_rx_mode
.globl _nrf24_check
.globl _nrf24_init
.globl _pwm_set_from_sbus
.globl _pwm_set
.globl _pwm_init
.globl _battery_read_mv
.globl _adc_init
.globl _spi_init
.globl _uart1_send_bytes
.globl _uart1_init
.globl _gpio_write
.globl _gpio_set_mode
.globl _delay_ms
.globl _EADC
.globl _ET1
.globl _ET0
.globl _ES
.globl _EA
.globl _REN
.globl _RI
.globl _TI
.globl _TR1
.globl _TF1
.globl _IT0
.globl _IE0
.globl _TR0
.globl _TF0
.globl _CMPCR2
.globl _CMPCR1
.globl _TA
.globl _IRCBAND_REG
.globl _IAP_TPS
.globl _IAP_CONTR
.globl _IAP_TRIG
.globl _IAP_CMD
.globl _IAP_ADDRL
.globl _IAP_ADDRH
.globl _IAP_DATA
.globl _WDT_CONTR
.globl _PCA_PWM3
.globl _PCA_PWM2
.globl _PCA_PWM1
.globl _PCA_PWM0
.globl _CCAP3L
.globl _CCAP2L
.globl _CCAP1L
.globl _CCAP0L
.globl _CCAPM3
.globl _CCAPM2
.globl _CCAPM1
.globl _CCAPM0
.globl _CMOD
.globl _CCON
.globl _ADCTIM_X
.globl _ADCCFG
.globl _ADC_RESL
.globl _ADC_RES
.globl _ADC_CONTR
.globl _SPDAT
.globl _SPCTL
.globl _SPSTAT
.globl _IP2H
.globl _IP2
.globl _IP
.globl _IE2
.globl _IE
.globl _BRT
.globl _P_SW1
.globl _SADEN
.globl _SADDR
.globl _S2BUF
.globl _S2CON
.globl _SBUF
.globl _SCON
.globl _TM4PS_X
.globl _TM3PS_X
.globl _TM2PS_X
.globl _T4T3M
.globl _T4L
.globl _T4H
.globl _T3L
.globl _T3H
.globl _T2L
.globl _T2H
.globl _INTCLKO
.globl _AUXR
.globl _TH1
.globl _TH0
.globl _TL1
.globl _TL0
.globl _TMOD
.globl _TCON
.globl _P_SW2
.globl _P5M0
.globl _P5M1
.globl _P4M0
.globl _P4M1
.globl _P3M0
.globl _P3M1
.globl _P2M0
.globl _P2M1
.globl _P1M0
.globl _P1M1
.globl _P0M0
.globl _P0M1
.globl _PSW
.globl _B
.globl _ACC
.globl _PCON
.globl _DPH
.globl _DPL
.globl _SP
.globl _P5
.globl _P4
.globl _P3
.globl _P2
.globl _P1
.globl _P0
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
.area RSEG (ABS,DATA)
.org 0x0000
_P0 = 0x0080
_P1 = 0x0090
_P2 = 0x00a0
_P3 = 0x00b0
_P4 = 0x00c0
_P5 = 0x00c8
_SP = 0x0081
_DPL = 0x0082
_DPH = 0x0083
_PCON = 0x0087
_ACC = 0x00e0
_B = 0x00f0
_PSW = 0x00d0
_P0M1 = 0x0093
_P0M0 = 0x0094
_P1M1 = 0x0091
_P1M0 = 0x0092
_P2M1 = 0x0095
_P2M0 = 0x0096
_P3M1 = 0x00b1
_P3M0 = 0x00b2
_P4M1 = 0x00b3
_P4M0 = 0x00b4
_P5M1 = 0x00c9
_P5M0 = 0x00ca
_P_SW2 = 0x00ba
_TCON = 0x0088
_TMOD = 0x0089
_TL0 = 0x008a
_TL1 = 0x008b
_TH0 = 0x008c
_TH1 = 0x008d
_AUXR = 0x008e
_INTCLKO = 0x008f
_T2H = 0x00d6
_T2L = 0x00d7
_T3H = 0x00d4
_T3L = 0x00d5
_T4H = 0x00d2
_T4L = 0x00d3
_T4T3M = 0x00d1
_TM2PS_X = 0xfea1
_TM3PS_X = 0xfea2
_TM4PS_X = 0xfea3
_SCON = 0x0098
_SBUF = 0x0099
_S2CON = 0x009a
_S2BUF = 0x009b
_SADDR = 0x00a9
_SADEN = 0x00b9
_P_SW1 = 0x00a2
_BRT = 0x009c
_IE = 0x00a8
_IE2 = 0x00af
_IP = 0x00b8
_IP2 = 0x00b6
_IP2H = 0x00b7
_SPSTAT = 0x00cd
_SPCTL = 0x00ce
_SPDAT = 0x00cf
_ADC_CONTR = 0x00bc
_ADC_RES = 0x00bd
_ADC_RESL = 0x00be
_ADCCFG = 0x00de
_ADCTIM_X = 0xfea8
_CCON = 0x00d8
_CMOD = 0x00d9
_CCAPM0 = 0x00da
_CCAPM1 = 0x00db
_CCAPM2 = 0x00dc
_CCAPM3 = 0x00dd
_CCAP0L = 0x00ea
_CCAP1L = 0x00eb
_CCAP2L = 0x00ec
_CCAP3L = 0x00ed
_PCA_PWM0 = 0x00f2
_PCA_PWM1 = 0x00f3
_PCA_PWM2 = 0x00f4
_PCA_PWM3 = 0x00f5
_WDT_CONTR = 0x00c1
_IAP_DATA = 0x00c2
_IAP_ADDRH = 0x00c3
_IAP_ADDRL = 0x00c4
_IAP_CMD = 0x00c5
_IAP_TRIG = 0x00c6
_IAP_CONTR = 0x00c7
_IAP_TPS = 0x00f7
_IRCBAND_REG = 0x009d
_TA = 0x00ae
_CMPCR1 = 0x00e6
_CMPCR2 = 0x00e7
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
.area RSEG (ABS,DATA)
.org 0x0000
_TF0 = 0x008d
_TR0 = 0x008c
_IE0 = 0x0089
_IT0 = 0x0088
_TF1 = 0x008f
_TR1 = 0x008e
_TI = 0x0099
_RI = 0x0098
_REN = 0x009c
_EA = 0x00af
_ES = 0x00ac
_ET0 = 0x00a9
_ET1 = 0x00ab
_EADC = 0x00ad
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
.area REG_BANK_0 (REL,OVR,DATA)
.ds 8
;--------------------------------------------------------
; overlayable bit register bank
;--------------------------------------------------------
.area BIT_BANK (REL,OVR,DATA)
bits:
.ds 1
b0 = bits[0]
b1 = bits[1]
b2 = bits[2]
b3 = bits[3]
b4 = bits[4]
b5 = bits[5]
b6 = bits[6]
b7 = bits[7]
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
.area DSEG (DATA)
_output_channels_frame_131072_54:
.ds 25
_make_ack_payload_mv_65536_57:
.ds 2
_s_ms_tick:
.ds 1
_s_ms_count:
.ds 2
_ms_tick_isr_last_rx_count_65537_63:
.ds 1
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
;--------------------------------------------------------
; Stack segment in internal ram
;--------------------------------------------------------
.area SSEG
__start__stack:
.ds 1
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
.area ISEG (DATA)
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
.area IABS (ABS,DATA)
.area IABS (ABS,DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
.area BSEG (BIT)
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
.area PSEG (PAG,XDATA)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
.area XSEG (XDATA)
_s_channels:
.ds 32
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area XABS (ABS,XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
.area XISEG (XDATA)
_s_frame_seq:
.ds 1
_s_frame_lost:
.ds 1
_s_led_tick_ms:
.ds 2
_s_led_state:
.ds 1
.area HOME (CODE)
.area GSINIT0 (CODE)
.area GSINIT1 (CODE)
.area GSINIT2 (CODE)
.area GSINIT3 (CODE)
.area GSINIT4 (CODE)
.area GSINIT5 (CODE)
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area CSEG (CODE)
;--------------------------------------------------------
; interrupt vector
;--------------------------------------------------------
.area HOME (CODE)
__interrupt_vect:
ljmp __sdcc_gsinit_startup
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
reti
.ds 7
ljmp _ms_tick_isr
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area HOME (CODE)
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area GSINIT (CODE)
.globl __sdcc_gsinit_startup
.globl __sdcc_program_startup
.globl __start__stack
.globl __mcs51_genXINIT
.globl __mcs51_genXRAMCLEAR
.globl __mcs51_genRAMCLEAR
;------------------------------------------------------------
;Allocation info for local variables in function 'ms_tick_isr'
;------------------------------------------------------------
;last_rx_count Allocated with name '_ms_tick_isr_last_rx_count_65537_63'
;------------------------------------------------------------
; src/main.c:137: static uint8_t last_rx_count = 0;
mov _ms_tick_isr_last_rx_count_65537_63,#0x00
; src/main.c:128: static volatile uint8_t s_ms_tick = 0;
mov _s_ms_tick,#0x00
; src/main.c:129: static volatile uint16_t s_ms_count = 0;
clr a
mov _s_ms_count,a
mov (_s_ms_count + 1),a
.area GSFINAL (CODE)
ljmp __sdcc_program_startup
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area HOME (CODE)
.area HOME (CODE)
__sdcc_program_startup:
ljmp _main
; return from main will return to caller
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area CSEG (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'sys_clock_init'
;------------------------------------------------------------
; src/main.c:48: static void sys_clock_init(void)
; -----------------------------------------
; function sys_clock_init
; -----------------------------------------
_sys_clock_init:
ar7 = 0x07
ar6 = 0x06
ar5 = 0x05
ar4 = 0x04
ar3 = 0x03
ar2 = 0x02
ar1 = 0x01
ar0 = 0x00
; src/main.c:53: P_SW2 |= 0x80;
orl _P_SW2,#0x80
; src/main.c:54: *((volatile uint8_t __xdata *)CLKSEL_X) = 0x00; /* 24MHz IRC */
mov dptr,#0xfe00
clr a
movx @dptr,a
; src/main.c:55: *((volatile uint8_t __xdata *)CLKDIV_X) = 0x00; /* 不分频 */
mov dptr,#0xfe01
movx @dptr,a
; src/main.c:56: P_SW2 &= ~0x80;
anl _P_SW2,#0x7f
; src/main.c:58: IRCBAND_REG = 0x02;
mov _IRCBAND_REG,#0x02
; src/main.c:59: }
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'led_init'
;------------------------------------------------------------
; src/main.c:61: static void led_init(void)
; -----------------------------------------
; function led_init
; -----------------------------------------
_led_init:
; src/main.c:63: gpio_set_mode(LED_PORT, LED_BIT, GPIO_MODE_PUSHPULL);
mov _gpio_set_mode_PARM_2,#0x02
mov _gpio_set_mode_PARM_3,#0x01
mov dpl,#0x03
lcall _gpio_set_mode
; src/main.c:64: gpio_write(LED_PORT, LED_BIT, 0);
mov _gpio_write_PARM_2,#0x02
mov _gpio_write_PARM_3,#0x00
mov dpl,#0x03
; src/main.c:65: }
ljmp _gpio_write
;------------------------------------------------------------
;Allocation info for local variables in function 'led_blink_tick'
;------------------------------------------------------------
; src/main.c:67: static void led_blink_tick(void)
; -----------------------------------------
; function led_blink_tick
; -----------------------------------------
_led_blink_tick:
; src/main.c:70: if (++s_led_tick_ms >= 100) { /* 100ms 闪烁 */
mov dptr,#_s_led_tick_ms
movx a,@dptr
add a,#0x01
movx @dptr,a
inc dptr
movx a,@dptr
addc a,#0x00
movx @dptr,a
mov dptr,#_s_led_tick_ms
movx a,@dptr
mov r6,a
inc dptr
movx a,@dptr
mov r7,a
clr c
mov a,r6
subb a,#0x64
mov a,r7
subb a,#0x00
jc 00103$
; src/main.c:71: s_led_tick_ms = 0;
mov dptr,#_s_led_tick_ms
clr a
movx @dptr,a
inc dptr
movx @dptr,a
; src/main.c:72: s_led_state ^= 1;
mov dptr,#_s_led_state
movx a,@dptr
xrl acc,#0x01
movx @dptr,a
; src/main.c:73: gpio_write(LED_PORT, LED_BIT, s_led_state);
mov dptr,#_s_led_state
movx a,@dptr
mov _gpio_write_PARM_3,a
mov _gpio_write_PARM_2,#0x02
mov dpl,#0x03
; src/main.c:75: }
ljmp _gpio_write
00103$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'output_channels'
;------------------------------------------------------------
;ch Allocated to registers r5 r6 r7
;mode Allocated to registers r4
;frame Allocated with name '_output_channels_frame_131072_54'
;------------------------------------------------------------
; src/main.c:78: static void output_channels(const uint16_t ch[SBUS_CH_COUNT])
; -----------------------------------------
; function output_channels
; -----------------------------------------
_output_channels:
mov r5,dpl
mov r6,dph
mov r7,b
; src/main.c:80: uint8_t mode = model_get_mode();
push ar7
push ar6
push ar5
lcall _model_get_mode
mov r4,dpl
pop ar5
pop ar6
pop ar7
; src/main.c:81: if (mode == MODE_PWM) {
cjne r4,#0x01,00117$
sjmp 00118$
00117$:
ljmp 00105$
00118$:
; src/main.c:83: pwm_set_from_sbus(0, ch[0]);
mov dpl,r5
mov dph,r6
mov b,r7
lcall __gptrget
mov _pwm_set_from_sbus_PARM_2,a
inc dptr
lcall __gptrget
mov (_pwm_set_from_sbus_PARM_2 + 1),a
mov dpl,#0x00
push ar7
push ar6
push ar5
lcall _pwm_set_from_sbus
pop ar5
pop ar6
pop ar7
; src/main.c:84: pwm_set_from_sbus(1, ch[1]);
mov a,#0x02
add a,r5
mov r1,a
clr a
addc a,r6
mov r2,a
mov ar3,r7
mov dpl,r1
mov dph,r2
mov b,r3
lcall __gptrget
mov _pwm_set_from_sbus_PARM_2,a
inc dptr
lcall __gptrget
mov (_pwm_set_from_sbus_PARM_2 + 1),a
mov dpl,#0x01
push ar7
push ar6
push ar5
lcall _pwm_set_from_sbus
pop ar5
pop ar6
pop ar7
; src/main.c:85: pwm_set_from_sbus(2, ch[2]);
mov a,#0x04
add a,r5
mov r1,a
clr a
addc a,r6
mov r2,a
mov ar3,r7
mov dpl,r1
mov dph,r2
mov b,r3
lcall __gptrget
mov _pwm_set_from_sbus_PARM_2,a
inc dptr
lcall __gptrget
mov (_pwm_set_from_sbus_PARM_2 + 1),a
mov dpl,#0x02
push ar7
push ar6
push ar5
lcall _pwm_set_from_sbus
pop ar5
pop ar6
pop ar7
; src/main.c:86: pwm_set_from_sbus(3, ch[3]);
mov a,#0x06
add a,r5
mov r1,a
clr a
addc a,r6
mov r2,a
mov ar3,r7
mov dpl,r1
mov dph,r2
mov b,r3
lcall __gptrget
mov _pwm_set_from_sbus_PARM_2,a
inc dptr
lcall __gptrget
mov (_pwm_set_from_sbus_PARM_2 + 1),a
mov dpl,#0x03
ljmp _pwm_set_from_sbus
00105$:
; src/main.c:87: } else if (mode == MODE_SBUS) {
mov a,r4
; src/main.c:90: sbus_make_uart_frame(ch, frame);
jnz 00107$
mov _sbus_make_uart_frame_PARM_2,#_output_channels_frame_131072_54
mov (_sbus_make_uart_frame_PARM_2 + 1),a
mov (_sbus_make_uart_frame_PARM_2 + 2),#0x40
mov dpl,r5
mov dph,r6
mov b,r7
lcall _sbus_make_uart_frame
; src/main.c:91: uart1_send_bytes(frame, 25);
mov _uart1_send_bytes_PARM_2,#0x19
mov dptr,#_output_channels_frame_131072_54
mov b,#0x40
; src/main.c:92: } else if (mode == MODE_UART) {
; src/main.c:95: }
ljmp _uart1_send_bytes
00107$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'make_ack_payload'
;------------------------------------------------------------
;buf Allocated to registers r5 r6 r7
;mv Allocated with name '_make_ack_payload_mv_65536_57'
;i Allocated to registers r4
;------------------------------------------------------------
; src/main.c:98: static void make_ack_payload(uint8_t *buf)
; -----------------------------------------
; function make_ack_payload
; -----------------------------------------
_make_ack_payload:
mov r5,dpl
mov r6,dph
mov r7,b
; src/main.c:100: uint16_t mv = battery_read_mv(); /* mV */
push ar7
push ar6
push ar5
lcall _battery_read_mv
mov _make_ack_payload_mv_65536_57,dpl
mov (_make_ack_payload_mv_65536_57 + 1),dph
pop ar5
pop ar6
pop ar7
; src/main.c:101: buf[0] = FRAME_ID_TELEMETRY;
mov dpl,r5
mov dph,r6
mov b,r7
mov a,#0xb0
lcall __gptrput
; src/main.c:102: buf[1] = s_frame_seq;
mov a,#0x01
add a,r5
mov r0,a
clr a
addc a,r6
mov r1,a
mov ar2,r7
mov dptr,#_s_frame_seq
movx a,@dptr
mov dpl,r0
mov dph,r1
mov b,r2
lcall __gptrput
; src/main.c:103: buf[2] = (uint8_t)(mv >> 8); /* voltage mV high */
mov a,#0x02
add a,r5
mov r2,a
clr a
addc a,r6
mov r3,a
mov ar4,r7
mov r1,(_make_ack_payload_mv_65536_57 + 1)
mov dpl,r2
mov dph,r3
mov b,r4
mov a,r1
lcall __gptrput
; src/main.c:104: buf[3] = (uint8_t)(mv & 0xFF); /* voltage mV low */
mov a,#0x03
add a,r5
mov r2,a
clr a
addc a,r6
mov r3,a
mov ar4,r7
mov r1,_make_ack_payload_mv_65536_57
mov dpl,r2
mov dph,r3
mov b,r4
mov a,r1
lcall __gptrput
; src/main.c:105: buf[4] = 0; /* current (预留) */
mov a,#0x04
add a,r5
mov r2,a
clr a
addc a,r6
mov r3,a
mov ar4,r7
mov dpl,r2
mov dph,r3
mov b,r4
clr a
lcall __gptrput
; src/main.c:107: for (uint8_t i = 5; i < NRF_PAYLOAD_LEN; i++) buf[i] = 0;
mov r4,#0x05
00103$:
cjne r4,#0x20,00116$
00116$:
jnc 00105$
mov a,r4
add a,r5
mov r1,a
clr a
addc a,r6
mov r2,a
mov ar3,r7
mov dpl,r1
mov dph,r2
mov b,r3
clr a
lcall __gptrput
inc r4
sjmp 00103$
00105$:
; src/main.c:108: }
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'handle_rx_frame'
;------------------------------------------------------------
;p Allocated to registers
;------------------------------------------------------------
; src/main.c:110: static void handle_rx_frame(void)
; -----------------------------------------
; function handle_rx_frame
; -----------------------------------------
_handle_rx_frame:
; src/main.c:112: uint8_t *p = g_nrf_status.ack_payload; /* 复用 */
; src/main.c:113: if (p[0] != FRAME_ID_CHANNELS) return;
mov dptr,#(_g_nrf_status + 0x0004)
movx a,@dptr
mov r7,a
cjne r7,#0xa0,00103$
; src/main.c:114: s_frame_seq = p[1];
mov dptr,#(_g_nrf_status + 0x0005)
mov b,#0x00
lcall __gptrget
mov dptr,#_s_frame_seq
movx @dptr,a
; src/main.c:117: sbus_unpack_channels(&p[4], (uint16_t *)s_channels);
mov _sbus_unpack_channels_PARM_2,#_s_channels
mov (_sbus_unpack_channels_PARM_2 + 1),#(_s_channels >> 8)
mov (_sbus_unpack_channels_PARM_2 + 2),#0x00
mov dptr,#(_g_nrf_status + 0x0008)
mov b,#0x00
lcall _sbus_unpack_channels
; src/main.c:119: s_frame_lost = 0;
mov dptr,#_s_frame_lost
clr a
movx @dptr,a
; src/main.c:120: output_channels(s_channels);
mov dptr,#_s_channels
mov b,#0x00
lcall _output_channels
; src/main.c:123: make_ack_payload(p);
mov dptr,#(_g_nrf_status + 0x0004)
mov b,#0x00
lcall _make_ack_payload
; src/main.c:124: nrf24_write_ack_payload(p);
mov dptr,#(_g_nrf_status + 0x0004)
mov b,#0x00
; src/main.c:125: }
ljmp _nrf24_write_ack_payload
00103$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'ms_tick_isr'
;------------------------------------------------------------
;last_rx_count Allocated with name '_ms_tick_isr_last_rx_count_65537_63'
;------------------------------------------------------------
; src/main.c:131: void ms_tick_isr(void) __interrupt (INT_ADDR_T1)
; -----------------------------------------
; function ms_tick_isr
; -----------------------------------------
_ms_tick_isr:
push bits
push acc
push b
push dpl
push dph
push (0+7)
push (0+6)
push (0+5)
push (0+4)
push (0+3)
push (0+2)
push (0+1)
push (0+0)
push psw
mov psw,#0x00
; src/main.c:134: s_ms_count++;
mov r6,_s_ms_count
mov r7,(_s_ms_count + 1)
mov a,#0x01
add a,r6
mov _s_ms_count,a
clr a
addc a,r7
mov (_s_ms_count + 1),a
; src/main.c:138: if (g_nrf_status.rx_count != last_rx_count) {
mov dptr,#(_g_nrf_status + 0x0001)
movx a,@dptr
mov r7,a
cjne a,_ms_tick_isr_last_rx_count_65537_63,00116$
sjmp 00102$
00116$:
; src/main.c:139: s_frame_lost = 0;
mov dptr,#_s_frame_lost
clr a
movx @dptr,a
; src/main.c:140: last_rx_count = g_nrf_status.rx_count;
mov dptr,#(_g_nrf_status + 0x0001)
movx a,@dptr
mov _ms_tick_isr_last_rx_count_65537_63,a
sjmp 00103$
00102$:
; src/main.c:142: s_frame_lost = 1;
mov dptr,#_s_frame_lost
mov a,#0x01
movx @dptr,a
00103$:
; src/main.c:145: led_blink_tick();
lcall _led_blink_tick
; src/main.c:148: if (s_frame_lost) {
mov dptr,#_s_frame_lost
movx a,@dptr
jz 00106$
; src/main.c:149: pwm_set(0, 1500); /* 失联时输出中位 */
mov _pwm_set_PARM_2,#0xdc
mov (_pwm_set_PARM_2 + 1),#0x05
mov dpl,#0x00
lcall _pwm_set
; src/main.c:150: pwm_set(1, 1500);
mov _pwm_set_PARM_2,#0xdc
mov (_pwm_set_PARM_2 + 1),#0x05
mov dpl,#0x01
lcall _pwm_set
; src/main.c:151: pwm_set(2, 1500);
mov _pwm_set_PARM_2,#0xdc
mov (_pwm_set_PARM_2 + 1),#0x05
mov dpl,#0x02
lcall _pwm_set
; src/main.c:152: pwm_set(3, 1500);
mov _pwm_set_PARM_2,#0xdc
mov (_pwm_set_PARM_2 + 1),#0x05
mov dpl,#0x03
lcall _pwm_set
00106$:
; src/main.c:154: }
pop psw
pop (0+0)
pop (0+1)
pop (0+2)
pop (0+3)
pop (0+4)
pop (0+5)
pop (0+6)
pop (0+7)
pop dph
pop dpl
pop b
pop acc
pop bits
reti
;------------------------------------------------------------
;Allocation info for local variables in function 'tick_init'
;------------------------------------------------------------
; src/main.c:156: static void tick_init(void)
; -----------------------------------------
; function tick_init
; -----------------------------------------
_tick_init:
; src/main.c:159: TMOD &= 0x0F;
anl _TMOD,#0x0f
; src/main.c:160: TMOD |= 0x00; /* T1 模式 0 (16 位自动重载) */
mov _TMOD,_TMOD
; src/main.c:161: AUXR &= ~0x40; /* T1x12 = 0: 12T 模式 */
anl _AUXR,#0xbf
; src/main.c:163: TL1 = 0xC0;
mov _TL1,#0xc0
; src/main.c:164: TH1 = 0x63;
mov _TH1,#0x63
; src/main.c:165: ET1 = 1;
; assignBit
setb _ET1
; src/main.c:166: TR1 = 1;
; assignBit
setb _TR1
; src/main.c:167: }
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
; src/main.c:169: int main(void)
; -----------------------------------------
; function main
; -----------------------------------------
_main:
; src/main.c:171: sys_clock_init();
lcall _sys_clock_init
; src/main.c:172: delay_ms(50); /* 等电源稳定 */
mov dptr,#0x0032
lcall _delay_ms
; src/main.c:174: led_init();
lcall _led_init
; src/main.c:177: uart1_init(UART_BAUD_CMD);
mov dptr,#0xc200
mov b,#0x01
clr a
lcall _uart1_init
; src/main.c:179: uart1_send_bytes("LoliRX boot\r\n", 14);
mov _uart1_send_bytes_PARM_2,#0x0e
mov dptr,#___str_0
mov b,#0x80
lcall _uart1_send_bytes
; src/main.c:181: spi_init();
lcall _spi_init
; src/main.c:182: adc_init();
lcall _adc_init
; src/main.c:185: if (nrf24_check() == NRF_OK) {
lcall _nrf24_check
mov a,dpl
jnz 00102$
; src/main.c:186: uart1_send_bytes("NRF OK\r\n", 8);
mov _uart1_send_bytes_PARM_2,#0x08
mov dptr,#___str_1
mov b,#0x80
lcall _uart1_send_bytes
sjmp 00103$
00102$:
; src/main.c:188: uart1_send_bytes("NRF FAIL\r\n", 10);
mov _uart1_send_bytes_PARM_2,#0x0a
mov dptr,#___str_2
mov b,#0x80
lcall _uart1_send_bytes
00103$:
; src/main.c:192: model_init();
lcall _model_init
; src/main.c:195: nrf24_init();
lcall _nrf24_init
; src/main.c:196: nrf24_set_rx_mode();
lcall _nrf24_set_rx_mode
; src/main.c:199: pwm_init();
lcall _pwm_init
; src/main.c:202: tick_init();
lcall _tick_init
; src/main.c:204: EA = 1;
; assignBit
setb _EA
; src/main.c:206: uart1_send_bytes("Ready\r\n", 7);
mov _uart1_send_bytes_PARM_2,#0x07
mov dptr,#___str_3
mov b,#0x80
lcall _uart1_send_bytes
00107$:
; src/main.c:210: cmd_poll();
lcall _cmd_poll
; src/main.c:213: if (nrf24_data_ready()) {
lcall _nrf24_data_ready
mov a,dpl
jz 00107$
; src/main.c:214: handle_rx_frame();
lcall _handle_rx_frame
; src/main.c:217: }
sjmp 00107$
.area CSEG (CODE)
.area CONST (CODE)
_DEFAULT_ADDR:
.db #0xe7 ; 231
.db #0xe7 ; 231
.db #0xe7 ; 231
.db #0xe7 ; 231
.db #0xc2 ; 194
.area CONST (CODE)
___str_0:
.ascii "LoliRX boot"
.db 0x0d
.db 0x0a
.db 0x00
.area CSEG (CODE)
.area CONST (CODE)
___str_1:
.ascii "NRF OK"
.db 0x0d
.db 0x0a
.db 0x00
.area CSEG (CODE)
.area CONST (CODE)
___str_2:
.ascii "NRF FAIL"
.db 0x0d
.db 0x0a
.db 0x00
.area CSEG (CODE)
.area CONST (CODE)
___str_3:
.ascii "Ready"
.db 0x0d
.db 0x0a
.db 0x00
.area CSEG (CODE)
.area XINIT (CODE)
__xinit__s_frame_seq:
.db #0x00 ; 0
__xinit__s_frame_lost:
.db #0x01 ; 1
__xinit__s_led_tick_ms:
.byte #0x00, #0x00 ; 0
__xinit__s_led_state:
.db #0x00 ; 0
.area CABS (ABS,CODE)