📄 can_sja1000.lss
字号:
4de: cd b7 in r28, 0x3d ; 61
4e0: de b7 in r29, 0x3e ; 62
unsigned char status;
status = BCAN_DATA_RECEIVE(); //接受数据
4e2: 0e 94 0b 02 call 0x416 ; 0x416 <BCAN_DATA_RECEIVE>
4e6: 89 83 std Y+1, r24 ; 0x01
if(status ==0 )
4e8: 89 81 ldd r24, Y+1 ; 0x01
4ea: 88 23 and r24, r24
4ec: 39 f4 brne .+14 ; 0x4fc <CanRcv_Prg+0x24>
{
if(Receive_BUF.FrameKIND == 1) //远程帧处理
4ee: 80 91 1e 01 lds r24, 0x011E
4f2: 81 30 cpi r24, 0x01 ; 1
4f4: 11 f4 brne .+4 ; 0x4fa <CanRcv_Prg+0x22>
{
nop;
4f6: 00 00 nop
4f8: 01 c0 rjmp .+2 ; 0x4fc <CanRcv_Prg+0x24>
}
else //数据帧处理
{
nop;
4fa: 00 00 nop
}
}
}
4fc: 0f 90 pop r0
4fe: cf 91 pop r28
500: df 91 pop r29
502: 08 95 ret
00000504 <SJA1000_Init>:
void SJA1000_Init(void)
{
504: df 93 push r29
506: cf 93 push r28
508: 0f 92 push r0
50a: cd b7 in r28, 0x3d ; 61
50c: de b7 in r29, 0x3e ; 62
unsigned char status;
cli();
50e: f8 94 cli
CANREG_WRITE(REG_CONTROL,0x07); //接受中断使能
510: 67 e0 ldi r22, 0x07 ; 7
512: 80 e0 ldi r24, 0x00 ; 0
514: 9f e7 ldi r25, 0x7F ; 127
516: 0e 94 90 00 call 0x120 ; 0x120 <CANREG_WRITE>
delayMs(1);
51a: 81 e0 ldi r24, 0x01 ; 1
51c: 90 e0 ldi r25, 0x00 ; 0
51e: 0e 94 65 00 call 0xca ; 0xca <delayMs>
status=BCAN_ENTER_RETMODEL();
522: 0e 94 c4 00 call 0x188 ; 0x188 <BCAN_ENTER_RETMODEL>
526: 89 83 std Y+1, r24 ; 0x01
delayMs(1);
528: 81 e0 ldi r24, 0x01 ; 1
52a: 90 e0 ldi r25, 0x00 ; 0
52c: 0e 94 65 00 call 0xca ; 0xca <delayMs>
CANREG_WRITE(REG_COMMAND,0x0e); //工作在正常模式
530: 6e e0 ldi r22, 0x0E ; 14
532: 81 e0 ldi r24, 0x01 ; 1
534: 9f e7 ldi r25, 0x7F ; 127
536: 0e 94 90 00 call 0x120 ; 0x120 <CANREG_WRITE>
delayMs(1);
53a: 81 e0 ldi r24, 0x01 ; 1
53c: 90 e0 ldi r25, 0x00 ; 0
53e: 0e 94 65 00 call 0xca ; 0xca <delayMs>
status=BCAN_SET_OBJECT(0x00,0xff); //验收代码寄存器ACR、验收屏蔽寄存器AMR
542: 6f ef ldi r22, 0xFF ; 255
544: 80 e0 ldi r24, 0x00 ; 0
546: 0e 94 10 01 call 0x220 ; 0x220 <BCAN_SET_OBJECT>
54a: 89 83 std Y+1, r24 ; 0x01
delayMs(1);
54c: 81 e0 ldi r24, 0x01 ; 1
54e: 90 e0 ldi r25, 0x00 ; 0
550: 0e 94 65 00 call 0xca ; 0xca <delayMs>
status=BCAN_SET_BANDRATE(0x04,0x1C);//设置CAN控制器通讯波特 12M,100k/s
554: 6c e1 ldi r22, 0x1C ; 28
556: 84 e0 ldi r24, 0x04 ; 4
558: 0e 94 40 01 call 0x280 ; 0x280 <BCAN_SET_BANDRATE>
55c: 89 83 std Y+1, r24 ; 0x01
delayMs(1);
55e: 81 e0 ldi r24, 0x01 ; 1
560: 90 e0 ldi r25, 0x00 ; 0
562: 0e 94 65 00 call 0xca ; 0xca <delayMs>
status=BCAN_SET_OUTCLK(0x1a,0x48);//设置CAN输出控制器OCR、时钟分频器CDR
566: 68 e4 ldi r22, 0x48 ; 72
568: 8a e1 ldi r24, 0x1A ; 26
56a: 0e 94 70 01 call 0x2e0 ; 0x2e0 <BCAN_SET_OUTCLK>
56e: 89 83 std Y+1, r24 ; 0x01
delayMs(1);
570: 81 e0 ldi r24, 0x01 ; 1
572: 90 e0 ldi r25, 0x00 ; 0
574: 0e 94 65 00 call 0xca ; 0xca <delayMs>
status=BCAN_QUIT_RETMODE();
578: 0e 94 ea 00 call 0x1d4 ; 0x1d4 <BCAN_QUIT_RETMODE>
57c: 89 83 std Y+1, r24 ; 0x01
delayMs(1);
57e: 81 e0 ldi r24, 0x01 ; 1
580: 90 e0 ldi r25, 0x00 ; 0
582: 0e 94 65 00 call 0xca ; 0xca <delayMs>
sei();
586: 78 94 sei
}
588: 0f 90 pop r0
58a: cf 91 pop r28
58c: df 91 pop r29
58e: 08 95 ret
00000590 <MCU_Init>:
void MCU_Init(void)
{
590: df 93 push r29
592: cf 93 push r28
594: cd b7 in r28, 0x3d ; 61
596: de b7 in r29, 0x3e ; 62
cli();
598: f8 94 cli
MCUCR |= (1<<SRE); //使能外部存储器
59a: a5 e5 ldi r26, 0x55 ; 85
59c: b0 e0 ldi r27, 0x00 ; 0
59e: e5 e5 ldi r30, 0x55 ; 85
5a0: f0 e0 ldi r31, 0x00 ; 0
5a2: 80 81 ld r24, Z
5a4: 80 68 ori r24, 0x80 ; 128
5a6: 8c 93 st X, r24
XMCRA = 0x80; //外部存储器地址空间为一个大区,无等待周期
5a8: ed e6 ldi r30, 0x6D ; 109
5aa: f0 e0 ldi r31, 0x00 ; 0
5ac: 80 e8 ldi r24, 0x80 ; 128
5ae: 80 83 st Z, r24
XMCRB = 0x00; //端口C全部用于高位地址
5b0: ec e6 ldi r30, 0x6C ; 108
5b2: f0 e0 ldi r31, 0x00 ; 0
5b4: 10 82 st Z, r1
DDRD |=(1<<DDD0)|(1<<DDD1); //PD0,PD1输出
5b6: a1 e3 ldi r26, 0x31 ; 49
5b8: b0 e0 ldi r27, 0x00 ; 0
5ba: e1 e3 ldi r30, 0x31 ; 49
5bc: f0 e0 ldi r31, 0x00 ; 0
5be: 80 81 ld r24, Z
5c0: 83 60 ori r24, 0x03 ; 3
5c2: 8c 93 st X, r24
PORTD &=(~((1<<PD0)|(1<<PD1)));
5c4: a2 e3 ldi r26, 0x32 ; 50
5c6: b0 e0 ldi r27, 0x00 ; 0
5c8: e2 e3 ldi r30, 0x32 ; 50
5ca: f0 e0 ldi r31, 0x00 ; 0
5cc: 80 81 ld r24, Z
5ce: 8c 7f andi r24, 0xFC ; 252
5d0: 8c 93 st X, r24
DDRE &=(~(1<<DDE4)); //中断引脚输入上拉
5d2: a2 e2 ldi r26, 0x22 ; 34
5d4: b0 e0 ldi r27, 0x00 ; 0
5d6: e2 e2 ldi r30, 0x22 ; 34
5d8: f0 e0 ldi r31, 0x00 ; 0
5da: 80 81 ld r24, Z
5dc: 8f 7e andi r24, 0xEF ; 239
5de: 8c 93 st X, r24
cli();
5e0: f8 94 cli
EICRB &=(~((1<<ISC41)|(1<<ISC40))); //INT4低电平产生中断
5e2: aa e5 ldi r26, 0x5A ; 90
5e4: b0 e0 ldi r27, 0x00 ; 0
5e6: ea e5 ldi r30, 0x5A ; 90
5e8: f0 e0 ldi r31, 0x00 ; 0
5ea: 80 81 ld r24, Z
5ec: 8c 7f andi r24, 0xFC ; 252
5ee: 8c 93 st X, r24
EIMSK |=(1<<INTF4); //INT4中断使能
5f0: a9 e5 ldi r26, 0x59 ; 89
5f2: b0 e0 ldi r27, 0x00 ; 0
5f4: e9 e5 ldi r30, 0x59 ; 89
5f6: f0 e0 ldi r31, 0x00 ; 0
5f8: 80 81 ld r24, Z
5fa: 80 61 ori r24, 0x10 ; 16
5fc: 8c 93 st X, r24
DDRB |= 1<<DDB0; //配置PB0为输出
5fe: a7 e3 ldi r26, 0x37 ; 55
600: b0 e0 ldi r27, 0x00 ; 0
602: e7 e3 ldi r30, 0x37 ; 55
604: f0 e0 ldi r31, 0x00 ; 0
606: 80 81 ld r24, Z
608: 81 60 ori r24, 0x01 ; 1
60a: 8c 93 st X, r24
PORTB &=(~(0<<PB0)); //pB0输出低电平,硬件复位sja1000
60c: a8 e3 ldi r26, 0x38 ; 56
60e: b0 e0 ldi r27, 0x00 ; 0
610: e8 e3 ldi r30, 0x38 ; 56
612: f0 e0 ldi r31, 0x00 ; 0
614: 80 81 ld r24, Z
616: 8c 93 st X, r24
delayMs(200); // 延时200ms
618: 88 ec ldi r24, 0xC8 ; 200
61a: 90 e0 ldi r25, 0x00 ; 0
61c: 0e 94 65 00 call 0xca ; 0xca <delayMs>
PORTB |= (1<<PB0);
620: a8 e3 ldi r26, 0x38 ; 56
622: b0 e0 ldi r27, 0x00 ; 0
624: e8 e3 ldi r30, 0x38 ; 56
626: f0 e0 ldi r31, 0x00 ; 0
628: 80 81 ld r24, Z
62a: 81 60 ori r24, 0x01 ; 1
62c: 8c 93 st X, r24
delayMs(200);
62e: 88 ec ldi r24, 0xC8 ; 200
630: 90 e0 ldi r25, 0x00 ; 0
632: 0e 94 65 00 call 0xca ; 0xca <delayMs>
//sei(); //开总中断
}
636: cf 91 pop r28
638: df 91 pop r29
63a: 08 95 ret
0000063c <main>:
int main(void)
{
63c: df 93 push r29
63e: cf 93 push r28
640: 00 d0 rcall .+0 ; 0x642 <main+0x6>
642: 00 d0 rcall .+0 ; 0x644 <main+0x8>
644: cd b7 in r28, 0x3d ; 61
646: de b7 in r29, 0x3e ; 62
unsigned char i,flag1=0;
648: 1b 82 std Y+3, r1 ; 0x03
unsigned char cmd_data,status;
MCU_Init();
64a: 0e 94 c8 02 call 0x590 ; 0x590 <MCU_Init>
SJA1000_Init();
64e: 0e 94 82 02 call 0x504 ; 0x504 <SJA1000_Init>
while(1)
{
delayMs(100);
652: 84 e6 ldi r24, 0x64 ; 100
654: 90 e0 ldi r25, 0x00 ; 0
656: 0e 94 65 00 call 0xca ; 0xca <delayMs>
//PORTD &= (~(1<<PD1));
delayMs(100);
65a: 84 e6 ldi r24, 0x64 ; 100
65c: 90 e0 ldi r25, 0x00 ; 0
65e: 0e 94 65 00 call 0xca ; 0xca <delayMs>
if(flag1==0)
662: 8b 81 ldd r24, Y+3 ; 0x03
664: 88 23 and r24, r24
666: 09 f0 breq .+2 ; 0x66a <main+0x2e>
668: 40 c0 rjmp .+128 ; 0x6ea <main+0xae>
{
Send_BUF.FrameID_H = 0;
66a: 10 92 02 01 sts 0x0102, r1
Send_BUF.FrameLENGTH = 8;
66e: 88 e0 ldi r24, 0x08 ; 8
670: 80 93 05 01 sts 0x0105, r24
Send_BUF.FrameKIND = 0;
674: 10 92 04 01 sts 0x0104, r1
Send_BUF.FrameID_L3 = 0;
678: 10 92 03 01 sts 0x0103, r1
if(Send_BUF.FrameKIND == 0)
67c: 80 91 04 01 lds r24, 0x0104
680: 88 23 and r24, r24
682: 91 f4 brne .+36 ; 0x6a8 <main+0x6c>
{
for(i=0;i<Send_BUF.FrameLENGTH;i++)
684: 1c 82 std Y+4, r1 ; 0x04
686: 0b c0 rjmp .+22 ; 0x69e <main+0x62>
{
Send_BUF.Frame_Data[i] = i;
688: 8c 81 ldd r24, Y+4 ; 0x04
68a: 88 2f mov r24, r24
68c: 90 e0 ldi r25, 0x00 ; 0
68e: fc 01 movw r30, r24
690: ea 5f subi r30, 0xFA ; 250
692: fe 4f sbci r31, 0xFE ; 254
694: 8c 81 ldd r24, Y+4 ; 0x04
696: 80 83 st Z, r24
Send_BUF.FrameLENGTH = 8;
Send_BUF.FrameKIND = 0;
Send_BUF.FrameID_L3 = 0;
if(Send_BUF.FrameKIND == 0)
{
for(i=0;i<Send_BUF.FrameLENGTH;i++)
698: 8c 81 ldd r24, Y+4 ; 0x04
69a: 8f 5f subi r24, 0xFF ; 255
69c: 8c 83 std Y+4, r24 ; 0x04
69e: 90 91 05 01 lds r25, 0x0105
6a2: 8c 81 ldd r24, Y+4 ; 0x04
6a4: 89 17 cp r24, r25
6a6: 80 f3 brcs .-32 ; 0x688 <main+0x4c>
{
Send_BUF.Frame_Data[i] = i;
}
}
BCAN_DATA_SEND();
6a8: 0e 94 a0 01 call 0x340 ; 0x340 <BCAN_DATA_SEND>
cmd_data =0x01; //发送请求
6ac: 81 e0 ldi r24, 0x01 ; 1
6ae: 8a 83 std Y+2, r24 ; 0x02
CANREG_WRITE(REG_COMMAND,0X01);
6b0: 61 e0 ldi r22, 0x01 ; 1
6b2: 81 e0 ldi r24, 0x01 ; 1
6b4: 9f e7 ldi r25, 0x7F ; 127
6b6: 0e 94 90 00 call 0x120 ; 0x120 <CANREG_WRITE>
delayMs(100);
6ba: 84 e6 ldi r24, 0x64 ; 100
6bc: 90 e0 ldi r25, 0x00 ; 0
6be: 0e 94 65 00 call 0xca ; 0xca <delayMs>
status=CANREG_READ(REG_INTERRUPT);
6c2: 83 e0 ldi r24, 0x03 ; 3
6c4: 9f e7 ldi r25, 0x7F ; 127
6c6: 0e 94 aa 00 call 0x154 ; 0x154 <CANREG_READ>
6ca: 89 83 std Y+1, r24 ; 0x01
if((status&0x02) == 0x02) PORTD |= (1<<PD1);
6cc: 89 81 ldd r24, Y+1 ; 0x01
6ce: 88 2f mov r24, r24
6d0: 90 e0 ldi r25, 0x00 ; 0
6d2: 82 70 andi r24, 0x02 ; 2
6d4: 90 70 andi r25, 0x00 ; 0
6d6: 00 97 sbiw r24, 0x00 ; 0
6d8: 39 f0 breq .+14 ; 0x6e8 <main+0xac>
6da: a2 e3 ldi r26, 0x32 ; 50
6dc: b0 e0 ldi r27, 0x00 ; 0
6de: e2 e3 ldi r30, 0x32 ; 50
6e0: f0 e0 ldi r31, 0x00 ; 0
6e2: 80 81 ld r24, Z
6e4: 82 60 ori r24, 0x02 ; 2
6e6: 8c 93 st X, r24
6e8: ff cf rjmp .-2 ; 0x6e8 <main+0xac>
while(1);
// PORTD |= (1<<PD1);
}
if(Send_Flag ==1)
6ea: 80 91 01 01 lds r24, 0x0101
6ee: 81 30 cpi r24, 0x01 ; 1
6f0: 09 f0 breq .+2 ; 0x6f4 <main+0xb8>
6f2: af cf rjmp .-162 ; 0x652 <main+0x16>
{
Send_Flag =0;
6f4: 10 92 01 01 sts 0x0101, r1
//PORTD |= (1<<PD1);
flag1=0;
6f8: 1b 82 std Y+3, r1 ; 0x03
6fa: ab cf rjmp .-170 ; 0x652 <main+0x16>
000006fc <__vector_5>:
return (0);
}
/**** 外部中断4中断处理函数 ****/
SIGNAL(SIG_INTERRUPT4)
{
6fc: 1f 92 push r1
6fe: 0f 92 push r0
700: 0f b6 in r0, 0x3f ; 63
702: 0f 92 push r0
704: 11 24 eor r1, r1
706: 8f 93 push r24
708: af 93 push r26
70a: bf 93 push r27
70c: ef 93 push r30
70e: ff 93 push r31
710: df 93 push r29
712: cf 93 push r28
714: 0f 92 push r0
716: cd b7 in r28, 0x3d ; 61
718: de b7 in r29, 0x3e ; 62
unsigned char sta;
cli();
71a: f8 94 cli
PORTD |= (1<<PD1);
71c: a2 e3 ldi r26, 0x32 ; 50
71e: b0 e0 ldi r27, 0x00 ; 0
720: e2 e3 ldi r30, 0x32 ; 50
722: f0 e0 ldi r31, 0x00 ; 0
724: 80 81 ld r24, Z
726: 82 60 ori r24, 0x02 ; 2
728: 8c 93 st X, r24
72a: ff cf rjmp .-2 ; 0x72a <__vector_5+0x2e>
0000072c <_exit>:
72c: f8 94 cli
0000072e <__stop_program>:
72e: ff cf rjmp .-2 ; 0x72e <__stop_program>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -