📄 main.s
字号:
in R2,0xf
std z+0,R2
.dbline 175
; SPI_DatConter++;
lds R24,_SPI_DatConter
subi R24,255 ; addi 1
sts _SPI_DatConter,R24
.dbline 176
; if(SPI_DatConter==SPI_DatLen)
lds R2,_SPI_DatLen
cp R24,R2
brne L66
.dbline 177
; {
.dbline 178
; SPI_Status=0x03;
ldi R24,3
sts _SPI_Status,R24
.dbline 179
; SPI_DatConter=0;
clr R2
sts _SPI_DatConter,R2
.dbline 180
; }
.dbline 181
; }
xjmp L66
L65:
.dbline 182
; else if(SPI_Status==0x03)
lds R24,_SPI_Status
cpi R24,3
brne L70
.dbline 183
; {
.dbline 184
; SPI_DatEnd=SPDR;
in R2,0xf
sts _SPI_DatEnd,R2
.dbline 185
; if(SPI_DatEnd!=0x16)
mov R24,R2
cpi R24,22
breq L72
.dbline 186
; {
.dbline 187
; SPI_validFrame=FALSE;
lds R24,_bit_flag
andi R24,239
sts _bit_flag,R24
.dbline 188
; }
xjmp L73
L72:
.dbline 190
; else
; {
.dbline 191
; SPI_RecvFifo[SPI_DatLen+2]=SPI_DatEnd;
ldi R24,<_SPI_RecvFifo+2
ldi R25,>_SPI_RecvFifo+2
lds R30,_SPI_DatLen
clr R31
add R30,R24
adc R31,R25
lds R2,_SPI_DatEnd
std z+0,R2
.dbline 192
; SPI_validFrame=TRUE;
lds R24,_bit_flag
ori R24,16
sts _bit_flag,R24
.dbline 193
; SPI_Status=0x00;
clr R2
sts _SPI_Status,R2
.dbline 194
; }
L73:
.dbline 195
; }
L70:
L66:
L63:
L59:
.dbline -2
L55:
ld R2,y+
out 0x3f,R2
ld R31,y+
ld R30,y+
ld R25,y+
ld R24,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.dbfunc e UART_RX_interrupt _UART_RX_interrupt fV
.even
_UART_RX_interrupt::
st -y,R2
st -y,R24
st -y,R25
st -y,R30
st -y,R31
in R2,0x3f
st -y,R2
.dbline -1
.dbline 198
; }
; void UART_RX_interrupt(void)
; {
.dbline 199
; if(RS485_validFrame)
lds R24,_bit_flag
lsr R24
lsr R24
lsr R24
andi R24,1
breq L76
.dbline 200
; {return;}
.dbline 200
xjmp L75
L76:
.dbline 201
; if(RS485_status==0x00)
lds R2,_RS485_status
tst R2
brne L78
.dbline 202
; {
.dbline 203
; RS485_data=UDR;
in R2,0xc
sts _RS485_data,R2
.dbline 204
; if(RS485_data!=0x68)
mov R24,R2
cpi R24,104
breq L80
.dbline 205
; {
.dbline 206
; RS485_status=0x00;
clr R2
sts _RS485_status,R2
.dbline 207
; }
xjmp L79
L80:
.dbline 209
; else
; {
.dbline 210
; RS485_status=0x01;
ldi R24,1
sts _RS485_status,R24
.dbline 211
; }
.dbline 212
; }
xjmp L79
L78:
.dbline 213
; else if(RS485_status==0x01)
lds R24,_RS485_status
cpi R24,1
brne L82
.dbline 214
; {
.dbline 215
; robotDatLen=UDR;
in R2,0xc
sts _robotDatLen,R2
.dbline 216
; RS485_status=0x02;
ldi R24,2
sts _RS485_status,R24
.dbline 217
; }
xjmp L83
L82:
.dbline 218
; else if(RS485_status==0x02)
lds R24,_RS485_status
cpi R24,2
brne L84
.dbline 219
; {
.dbline 220
; robotDatBuf[robotDatCount]=UDR;
ldi R24,<_robotDatBuf
ldi R25,>_robotDatBuf
lds R30,_robotDatCount
clr R31
add R30,R24
adc R31,R25
in R2,0xc
std z+0,R2
.dbline 221
; robotDatCount++;
lds R24,_robotDatCount
subi R24,255 ; addi 1
sts _robotDatCount,R24
.dbline 222
; if(robotDatCount==robotDatLen)
lds R2,_robotDatLen
cp R24,R2
brne L85
.dbline 223
; {
.dbline 224
; RS485_status=0x03;
ldi R24,3
sts _RS485_status,R24
.dbline 225
; robotDatCount=0;
clr R2
sts _robotDatCount,R2
.dbline 226
; }
.dbline 227
; }
xjmp L85
L84:
.dbline 228
; else if(RS485_status==0x03)
lds R24,_RS485_status
cpi R24,3
brne L88
.dbline 229
; {
.dbline 230
; robotDatEnd=UDR;
in R2,0xc
sts _robotDatEnd,R2
.dbline 231
; if(robotDatEnd!=0x16)
mov R24,R2
cpi R24,22
breq L90
.dbline 232
; {
.dbline 233
; RS485_validFrame=FALSE;
lds R24,_bit_flag
andi R24,247
sts _bit_flag,R24
.dbline 234
; PORTC|=0x02;
sbi 0x15,1
.dbline 235
; }
xjmp L91
L90:
.dbline 237
; else
; {
.dbline 238
; RS485_validFrame=TRUE;
lds R24,_bit_flag
ori R24,8
sts _bit_flag,R24
.dbline 239
; RS485_status=0x00;
clr R2
sts _RS485_status,R2
.dbline 240
; PORTC=0x01;
ldi R24,1
out 0x15,R24
.dbline 241
; }
L91:
.dbline 242
; }
L88:
L85:
L83:
L79:
.dbline -2
L75:
ld R2,y+
out 0x3f,R2
ld R31,y+
ld R30,y+
ld R25,y+
ld R24,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.dbfunc e Uart_SendByte _Uart_SendByte fV
.even
_Uart_SendByte::
.dbline -1
.dbline 245
; }
; void Uart_SendByte(void)
; {
L93:
.dbline 246
L94:
.dbline 246
; while(!(UCSRA&(1<<UDRE)));
sbis 0xb,5
rjmp L93
.dbline 247
; UDR=(*Uart_send_ptr);
lds R30,_Uart_send_ptr
lds R31,_Uart_send_ptr+1
ldd R2,z+0
out 0xc,R2
.dbline -2
L92:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Uart_SendPacket _Uart_SendPacket fV
; BufferAddress -> R22,R23
; len -> R20
.even
_Uart_SendPacket::
xcall push_gset2
movw R22,R18
mov R20,R16
.dbline -1
.dbline 250
; }
; void Uart_SendPacket(Uchar len, Uchar *BufferAddress)
; {
.dbline 251
; Uart_send_ptr=BufferAddress;
sts _Uart_send_ptr+1,R23
sts _Uart_send_ptr,R22
xjmp L98
L97:
.dbline 253
.dbline 254
xcall _Uart_SendByte
.dbline 255
dec R20
.dbline 256
lds R24,_Uart_send_ptr
lds R25,_Uart_send_ptr+1
adiw R24,1
sts _Uart_send_ptr+1,R25
sts _Uart_send_ptr,R24
.dbline 257
L98:
.dbline 252
; while(len>0)
clr R2
cp R2,R20
brlo L97
.dbline -2
L96:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r BufferAddress 22 pc
.dbsym r len 20 c
.dbend
.dbfunc e ADC_init _ADC_init fV
.even
_ADC_init::
.dbline -1
.dbline 261
; {
; Uart_SendByte();
; len--;
; Uart_send_ptr++;
; }
; }
;
; void ADC_init(void)
; {
.dbline 262
; ADCSRA=0x00;
clr R2
out 0x6,R2
.dbline 263
; ADMUX=0x40;
ldi R24,64
out 0x7,R24
.dbline 264
; ACSR|=(1<<ACD);
sbi 0x8,7
.dbline 265
; ADCSRA=(1<<ADEN)|0x06;//不使能中断
ldi R24,134
out 0x6,R24
.dbline 266
; SFIOR=0x00;
out 0x30,R2
.dbline 267
; PORTA=0x00;
out 0x1b,R2
.dbline -2
L100:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Read_Adc _Read_Adc fV
; Msbtemp -> y+10
; Lsbtemp -> y+0
; i -> R16
.even
_Read_Adc::
sbiw R28,20
.dbline -1
.dbline 270
; }
; void Read_Adc(void)
; {
.dbline 274
; unsigned char i;
; unsigned char Lsbtemp[10],Msbtemp[10];
;
; Lsb_light=0;
clr R2
sts _Lsb_light,R2
.dbline 275
; Msb_light=0;
sts _Msb_light,R2
.dbline 276
; for(i=0;i<1;i++)
clr R16
xjmp L105
L102:
.dbline 277
; {
.dbline 278
; ADCSRA|=(1<<ADSC);
sbi 0x6,6
L106:
.dbline 279
L107:
.dbline 279
sbis 0x6,4
rjmp L106
.dbline 280
movw R24,R28
mov R30,R16
clr R31
add R30,R24
adc R31,R25
in R2,0x4
std z+0,R2
.dbline 281
movw R24,R28
adiw R24,10
mov R30,R16
clr R31
add R30,R24
adc R31,R25
in R2,0x5
std z+0,R2
.dbline 282
L103:
.dbline 276
inc R16
L105:
.dbline 276
cpi R16,1
brlo L102
.dbline 283
; while((ADCSRA&(1<<ADIF))==0);
; Lsbtemp[i]=ADCL;
; Msbtemp[i]=ADCH;
; }
; for(i=0;i<1;i++)
clr R16
xjmp L112
L109:
.dbline 284
.dbline 285
movw R24,R28
mov R30,R16
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
lds R3,_Lsb_light
add R3,R2
sts _Lsb_light,R3
.dbline 286
movw R24,R28
adiw R24,10
mov R30,R16
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
lds R3,_Msb_light
add R3,R2
sts _Msb_light,R3
.dbline 287
L110:
.dbline 283
inc R16
L112:
.dbline 283
cpi R16,1
brlo L109
.dbline 288
; {
; Lsb_light+=Lsbtemp[i];
; Msb_light+=Msbtemp[i];
; }
; Lsb_light=Lsb_light/1;
lds R2,_Lsb_light
sts _Lsb_light,R2
.dbline 289
; Msb_light=Msb_light/1;
lds R2,_Msb_light
sts _Msb_light,R2
.dbline 290
; voltage_light=Msb_light;
clr R3
sts _voltage_light+1,R3
sts _voltage_light,R2
.dbline 291
; voltage_light=(unsigned int)voltage_light<<8|Lsb_light;
lds R2,_Lsb_light
lds R4,_voltage_light
lds R5,_voltage_light+1
mov R3,R4
sts _voltage_light+1,R3
sts _voltage_light,R2
.dbline -2
L101:
adiw R28,20
.dbline 0 ; func end
ret
.dbsym l Msbtemp 10 A[10:10]c
.dbsym l Lsbtemp 0 A[10:10]c
.dbsym r i 16 c
.dbend
.area bss(ram, con, rel)
.dbfile E:\PROGRAMS\controller\salvo-M32\main.c
_com_data_buffer::
.blkb 10
.dbfile E:\PROGRAMS\controller\salvo-M32/app.h
.dbsym e com_data_buffer _com_data_buffer A[10:10]c
_com_send_ptr::
.blkb 2
.dbsym e com_send_ptr _com_send_ptr pc
_com_datasen_len::
.blkb 1
.dbsym e com_datasen_len _com_datasen_len c
_SetCompass::
.blkb 2
.dbsym e SetCompass _SetCompass i
_Lsb_light::
.blkb 1
.dbsym e Lsb_light _Lsb_light c
_Msb_light::
.blkb 1
.dbsym e Msb_light _Msb_light c
_voltage_light::
.blkb 2
.dbsym e voltage_light _voltage_light i
_Pout_SPI_TranFIfo::
.blkb 2
.dbsym e Pout_SPI_TranFIfo _Pout_SPI_TranFIfo pc
_Pin_SPI_TranFifo::
.blkb 2
.dbsym e Pin_SPI_TranFifo _Pin_SPI_TranFifo pc
_Pout_SPI_RecvFifo::
.blkb 2
.dbsym e Pout_SPI_RecvFifo _Pout_SPI_RecvFifo pc
_Pin_SPI_RecvFifo::
.blkb 2
.dbsym e Pin_SPI_RecvFifo _Pin_SPI_RecvFifo pc
_SPI_TranFifo::
.blkb 16
.dbsym e SPI_TranFifo _SPI_TranFifo A[16:16]c
_SPI_RecvFifo::
.blkb 16
.dbsym e SPI_RecvFifo _SPI_RecvFifo A[16:16]c
_SPI_DatEnd::
.blkb 1
.dbsym e SPI_DatEnd _SPI_DatEnd c
_SPI_DatCheck::
.blkb 1
.dbsym e SPI_DatCheck _SPI_DatCheck c
_SPI_DatConter::
.blkb 1
.dbsym e SPI_DatConter _SPI_DatConter c
_SPI_DatLen::
.blkb 1
.dbsym e SPI_DatLen _SPI_DatLen c
_SPI_CtrCode::
.blkb 1
.dbsym e SPI_CtrCode _SPI_CtrCode c
_SPI_data::
.blkb 1
.dbsym e SPI_data _SPI_data c
_SPI_Status::
.blkb 1
.dbsym e SPI_Status _SPI_Status c
_bit_flag::
.blkb 1
.dbstruct 0 1 data
.dbfield 0 bit0 F[0:1]
.dbfield 0 bit1 F[1:1]
.dbfield 0 bit2 F[2:1]
.dbfield 0 bit3 F[3:1]
.dbfield 0 bit4 F[4:1]
.dbfield 0 bit5 F[5:1]
.dbfield 0 bit6 F[6:1]
.dbfield 0 bit7 F[7:1]
.dbend
.dbsym e bit_flag _bit_flag S[data]
_Uart_send_ptr::
.blkb 2
.dbsym e Uart_send_ptr _Uart_send_ptr pc
_robotDatEnd::
.blkb 1
.dbsym e robotDatEnd _robotDatEnd c
_robotDatCheck::
.blkb 1
.dbsym e robotDatCheck _robotDatCheck c
_robotDatCount::
.blkb 1
.dbsym e robotDatCount _robotDatCount c
_robotDatBuf::
.blkb 10
.dbsym e robotDatBuf _robotDatBuf A[10:10]c
_robotDatLen::
.blkb 1
.dbsym e robotDatLen _robotDatLen c
_robotCtrCode::
.blkb 1
.dbsym e robotCtrCode _robotCtrCode c
_RS485_data::
.blkb 1
.dbsym e RS485_data _RS485_data c
_RS485_status::
.blkb 1
.dbsym e RS485_status _RS485_status c
.area func_lit
PL_TaskC: .word `_TaskC
PL_TaskB: .word `_TaskB
PL_TaskA: .word `_TaskA
PL_TaskC1: .word `_TaskC1
PL_TaskB1: .word `_TaskB1
PL_TaskA1: .word `_TaskA1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -