📄 240x8515.lst
字号:
000079 9aab sbi PortC,DATA ; Set Data HIGH
00007a d06c rcall DoSPIClock ; Make one SPIClock cycle
00007b 98aa cbi PortC,CS ; Set CS LOW
00007c 98a3 cbi DDRC,DATA ; Set Data as input
00007d 9aac sbi PortC,CE ; Set CE HIGH
00007e 9508 ret
;************************************************* RXEN END ************************************************
;******************************************** nRF2401_ON START *********************************************
00007f 9a95 nRF2401_ON: sbi PortD,PWR_UP ; Set Power_Up HIGH
000080 9508 ret
;*********************************************** nRF2401_ON END ********************************************
;********************************************** nRF2401_OFF START ******************************************
000081 9895 nRF2401_OFF: cbi PortD,PWR_UP ; Set Power_Up LOW
000082 9508 ret
;********************************************** nRF2401_OFF END *******************************************
;************************************************ CE_High START *******************************************
000083 9aac CE_High: sbi PortC,CE ; Set CE HIGH
000084 9508 ret
;************************************************* CE_High END ********************************************
;************************************************ CE_Low START ********************************************
000085 98ac CE_Low: cbi PortC,CE ; Set CE LOW
000086 9508 ret
;************************************************* CE_Low END ********************************************
;**********************************************************************************************************
000087 94f8 BuildSPIWord: cli
000088 e6e0 ldi Zl,SPIADDRESS
000089 27ff clr Zh
00008a e00f ldi temp,15 ; Number of bytes
00008b 9301 st Z+,temp
00008c e500 ldi temp,0x50 ; MSB ; RX receiver 2, datalength 80bit(10 byte)
00008d 9301 st Z+,temp
00008e e500 ldi temp,0x50 ; MSB-1 ; RX receiver 1, datalength 80bit(10 byte)
00008f 9301 st Z+,temp
000090 e000 ldi temp,0x00 ; MSB-2
000091 9301 st Z+,temp
000092 ec0c ldi temp,0xCC ; MSB-3
000093 9301 st Z+,temp
000094 ec0c ldi temp,0xCC ; MSB-4
000095 9301 st Z+,temp
000096 ec0c ldi temp,0xCC ; MSB-5
000097 9301 st Z+,temp
000098 ec0c ldi temp,0xCC ; MSB-6
000099 9301 st Z+,temp
00009a e000 ldi temp,0x00 ; MSB-7
00009b 9301 st Z+,temp
00009c ec0c ldi temp,0xCC ; MSB-8 ;RX receiver 1 address High byte
00009d 9301 st Z+,temp
00009e ec0c ldi temp,0xCC ; MSB-9 ;RX receiver 1 address High byte
00009f 9301 st Z+,temp
0000a0 ec0c ldi temp,0xCC ; MSB-10 ;RX receiver 1 address Low byte
0000a1 9301 st Z+,temp
0000a2 ec0c ldi temp,0xCC ; MSB-11 ;RX receiver 1 address Low byte
0000a3 9301 st Z+,temp
; ldi temp,0x82 ; MSB-12 ;this is for 32 bit address(Bit7-Bit2), 16bit CRC(Bit1), CRC disable(Bit0) for ES chip
0000a4 e803 ldi temp,0x83 ; MSB-12 ;this is for 32 bit address(Bit7-Bit2), 16bit CRC(Bit1), CRC enable(Bit0) for final chip
0000a5 9301 st Z+,temp
0000a6 e40f ldi temp,0x4F ; MSB-13 ;One receiver(Bit7), shock Mode(Bit6), datarate(Bit5) 250K, crystal(Bit4-Bit2), RF Power(Bit1-Bit0)
; ldi temp,0x6F ; MSB-13 ;One receiver(Bit7), shock Mode(Bit6), datarate(Bit5) 1M, crystal(Bit4-Bit2), RF Power(Bit1-Bit0)
0000a7 9301 st Z+,temp
0000a8 e005 ldi temp,0x05 ; MSB-14 ;Channel Number(Bit7-Bit1), RX/TX mode(Bit0)
0000a9 9301 st Z+,temp
; sei
0000aa 9508 ret
;*************************************************************************************************************
BuildShockWord:
0000ab 94f8 cli
0000ac e8e0 ldi Zl,TXDATAADDRESS
0000ad 27ff clr Zh
0000ae e00e ldi temp,14 ; Number of bytes
0000af 9301 st Z+,temp
0000b0 ec0c ldi temp,0xCC ; MSB ;RX receiver 1 address High byte
0000b1 9301 st Z+,temp
0000b2 ec0c ldi temp,0xCC ; MSB-1 ;RX receiver 1 address High byte
0000b3 9301 st Z+,temp
0000b4 ec0c ldi temp,0xCC ; MSB-2 ;RX receiver 1 address Low byte
0000b5 9301 st Z+,temp
0000b6 ec0c ldi temp,0xCC ; MSB-3 ;RX receiver 1 address Low byte
0000b7 9301 st Z+,temp
; mov temp,data1 ; MSB-4 ;data byte 9
0000b8 9321 st Z+,data1
0000b9 e002 ldi temp,0x02 ; MSB-5 ; data byte 8
0000ba 9301 st Z+,temp
0000bb e003 ldi temp,0x03 ; MSB-6 ; data byte 7
0000bc 9301 st Z+,temp
0000bd e004 ldi temp,0x04 ; MSB-7 ; data byte 6
0000be 9301 st Z+,temp
0000bf e005 ldi temp,0x05 ; MSB-8 ; data byte 5
0000c0 9301 st Z+,temp
0000c1 e006 ldi temp,0x06 ; MSB-9 ; data byte 4
0000c2 9301 st Z+,temp
0000c3 e007 ldi temp,0x07 ; MSB-10 ; data byte 3
0000c4 9301 st Z+,temp
0000c5 e008 ldi temp,0x08 ; MSB-11 ; data byte 2
0000c6 9301 st Z+,temp
0000c7 e009 ldi temp,0x09 ; MSB-12 ; data byte 1
0000c8 9301 st Z+,temp
0000c9 e100 ldi temp,0x010 ; MSB-13 ; data byte 0
0000ca 9301 st Z+,temp
; sei
0000cb 9508 ret
;********************************************** SPInRF2401 START *******************************************
;***********************************************************************************************************
0000cc 94f8 SPInRF2401: cli ; Disable Interupts to prevent interupt handling
; push r16 ; Save registers
; push r17 ; Save registers
; push r18 ; Save registers
0000cd e6e0 ldi Zl,SPIADDRESS ; Load Address for where SPI data starts
0000ce 27ff clr Zh ; Load Address for where SPI data starts
0000cf 9aa3 sbi DDRC,DATA ; Set data as output (low)
0000d0 9aa0 sbi DDRC,CLK1 ; Set clock as output (low)
0000d1 98ac cbi PORTC,CE ; Disable CE
0000d2 9aaa sbi PORTC,CS ; Enable CS
0000d3 9161 ld ByteCnt,Z+ ; Number of bytes to be programmed in "ByteCnt"
0000d4 9101 Highloop: ld temp,Z+ ; Data in "temp"
0000d5 e058 ldi BitCnt,8 ; "BitCnt" tracks number of programmed bits
0000d6 ff07 LowLoop: sbrs temp,7 ; Check if first bit is HIGH
0000d7 98ab cbi PORTC,DATA ; NO: Set Data low
0000d8 fd07 sbrc temp,7 ; Check if first bit is LOW
0000d9 9aab sbi PORTC,DATA ; NO: Set Data high
0000da d00c rcall DoSPIClock ; Call "DoClock" to generate a clock pulse
0000db 955a dec BitCnt ; Decrement "BitCnt"
0000dc 0f00 lsl temp ; Left Shift to get next bit
0000dd 3050 cpi BitCnt,0 ; Chcek if all bits are written in this byte
0000de f7b9 brne Lowloop ; NO: Write next one
0000df 956a dec ByteCnt ; YES: Decrement "ByteCnt"
0000e0 3060 cpi ByteCnt,0 ; Check if all bytes are written in this SPI round
0000e1 f791 brne Highloop ; NO: Get next byte and write it out
0000e2 98aa SPIReturn: cbi PORTC,CS ; Disable CS
0000e3 98ab cbi PORTC,DATA ; Set Data low
0000e4 98a3 cbi DDRC,DATA ; Set data as input (low)
0000e5 98a0 cbi DDRC,CLK1 ; Set data as input (low)
; pop r18 ; Restore registers
; pop r17 ; Restore registers
; pop r16 ; Restore registers
; sei ; Enable Interupts
0000e6 9508 ret
0000e7 9aa8 DoSPIClock: sbi PORTC,CLK1
0000e8 0000 nop
0000e9 0000 nop
0000ea 98a8 cbi PORTC,CLK1
0000eb 9508 ret
;********************************************** SPInRF2401 END ********************************************
;********************************************* ShockBurst START *******************************************
;**********************************************************************************************************
0000ec 94f8 ShockBurst: cli
; push r16 ; Save registers
; push r17 ; Save registers
; push r18 ; Save registers
0000ed 9aa3 GOGO: sbi DDRC,Data ; Set data as output (low)
0000ee 9aa0 sbi DDRC,Clk1 ; Set CLK1 as output (low)
0000ef 98aa cbi PORTC,CS ; Pull CS low
0000f0 9aac sbi PORTC,CE ; Enable CE
0000f1 e8e0 ldi Zl,TXDATAADDRESS ; Load Address for where data starts
0000f2 27ff clr Zh ; Load Address for where data starts
0000f3 9161 ld ByteCnt,Z+ ; Load number of bytes to be send
0000f4 9101 BurstLoop1: ld temp,Z+ ; Load databyte in temp
0000f5 d007 rcall SendData ; Call SendData
0000f6 956a dec ByteCnt ; Check if all bytes are sendt
0000f7 3060 cpi ByteCnt,0
0000f8 f7d9 brne BurstLoop1 ; NO: Loop around and do it again
0000f9 98ac BurstReturn: cbi PORTC,CE ; Disable CE (TX Starts!);
0000fa 98ab cbi PORTC,Data ; Set Data low
0000fb 98a3 cbi DDRC,Data ; Set data as input (low)
; cbi DDRC,Clk1 ; Set Clock as input (low)
NOGOGO: ; pop r18 ; Restore registers
; pop r17 ; Restore registers
; pop r16 ; Restore registers
; sei
0000fc 9508 ret
0000fd e058 SendData: ldi BitCnt,8 ; Load number of bits in 'BitCnt'
0000fe ff07 LowLoopburst: sbrs temp,7
0000ff 98ab cbi PORTC,Data ; Set Data low
000100 fd07 sbrc temp,7
000101 9aab sbi PORTC,Data ; Set Data high
000102 dfe4 rcall DoSPIClock
000103 955a dec BitCnt
000104 0f00 lsl temp
000105 3050 cpi BitCnt,0
000106 f7b9 brne Lowloopburst
000107 9508 ret
;*********************************************************************************************
;****************************** ReceiveShock START *******************************************
;*********************************************************************************************
000108 94f8 ReceiveShock: cli
Rxnext: ; push r16 ; Save registers
; push r17 ; Save registers
; push r18 ; Save registers
000109 98a3 cbi DDRC,Data ; Set data as input
00010a 9aa0 sbi DDRC,Clk1 ; Set clock as output
00010b 98ab cbi PortC,Data ; Set data tri state
00010c e9e0 ldi Zl,RXDATAADDRESS
00010d 27ff clr Zh
00010e 2766 clr ByteCnt
00010f 2700 R1: clr temp
000110 2755 clr BitCnt
000111 0f00 in1loop: lsl temp ; shift left to receive next bit
000112 9aa8 sbi PORTC,Clk1 ; set clock high
000113 0000 nop
000114 0000 nop ; wait one clk cycle
000115 999b sbic PinC,Data ; check if Data=low
000116 6001 ori temp,1 ; no - set bit high
000117 98a8 cbi PORTC,Clk1 ; set clock low
000118 0000 nop ; wait one clk cycle
000119 9553 inc BitCnt ; increment bit counter
00011a 3058 cpi BitCnt,8 ;
00011b f7a9 brne in1loop
00011c 0000 nop
00011d 9563 inc ByteCnt
00011e 9301 st Z+,temp
00011f 9b83 sbis PinD,DR1 ; check if DR1 is still high
000120 c001 rjmp Receiveret ; no, jump to receive return
000121 cfed rjmp R1
000122 0000 Receiveret: nop
000123 e9e0 SendToPORTA: ldi Zl,RXDATAADDRESS ; Load Address for where data starts
000124 27ff clr Zh ; Load Address for where data starts
; ldi ByteCnt,11 ; Load number of bytes to be send
000125 8100 SendLoop: ld temp,Z ; Load databyte in temp
000126 bb0b out PortA,temp ; Turn On the LED
;
000127 df27 rcall delay100 ;
000128 ef0f ldi temp,0xff ;2003.1.9
000129 bb0b out PortA,temp
00012a 9508 ret
;************************************* ReceiveShock END *********************************
;****************************************************************************************
;****************************************************************************************
00012b 94f8 BuildTestWord: cli
00012c e8e0 ldi Zl,TXDATAADDRESS ;"WIRELESS.."
00012d 27ff clr Zh
00012e e507 ldi temp,0x57 ; MSB ;RX receiver 1 address High byte
00012f 9301 st Z+,temp
000130 e409 ldi temp,0x49 ; MSB-1 ;RX receiver 1 address High byte
000131 9301 st Z+,temp
000132 e502 ldi temp,0x52 ; MSB-2 ;RX receiver 1 address Low byte
000133 9301 st Z+,temp
000134 e405 ldi temp,0x45 ; MSB-3 ;RX receiver 1 address Low byte
000135 9301 st Z+,temp
000136 e40c ldi temp,0x4c ; MSB-4 ; data byte 9
000137 9301 st Z+,temp
000138 e405 ldi temp,0x45 ; MSB-5 ; data byte 8
000139 9301 st Z+,temp
00013a e503 ldi temp,0x53 ; MSB-6 ; data byte 7
00013b 9301 st Z+,temp
00013c e503 ldi temp,0x53 ; MSB-7 ; data byte 6
00013d 9301 st Z+,temp
00013e e20e ldi temp,0x2e ; MSB-8 ; data byte 5
00013f 9301 st Z+,temp
000140 e20e ldi temp,0x2e ; MSB-9 ; data byte 4
000141 9301 st Z+,temp
; sei
000142 9508 ret
;***************************************************************************************************
Assembly complete with no errors.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -