⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 can.s

📁 can tongxunCAN128的底层驱动
💻 S
📖 第 1 页 / 共 3 页
字号:
	.module can.c
	.area text(rom, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.area lit(rom, con, rel)
_CanBaud::
	.byte 2,4
	.byte 19
	.byte 6,4
	.byte 19
	.byte 14,4
	.byte 19
	.byte 18,4
	.byte 19
	.byte 30,4
	.byte 19
	.byte 38,4
	.byte 19
	.dbsym e CanBaud _CanBaud A[18:6:3]kc
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
_CANMOBID::
	.blkb 4
	.area idata
	.word 65281,4864
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65281,4864
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,512
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,512
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,512
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 1,4608
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 512,256
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65281,4864
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.dbsym e CANMOBID _CANMOBID A[60:15]l
_CANMOBMD::
	.blkb 4
	.area idata
	.word 65535,7936
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65535,7936
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 255,7936
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65280,3840
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 4
	.area idata
	.word 65535,7936
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.dbsym e CANMOBMD _CANMOBMD A[60:15]l
_CANIDT::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 3
	.area idata
	.byte 0,0,0
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 56
	.area idata
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.byte 0,0,0,0,0,0
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.dbsym e CANIDT _CANIDT A[60:15:4]c
_CANIDM::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 3
	.area idata
	.byte 0,0,0
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.blkb 56
	.area idata
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.word 0,0,0,0,0
	.byte 0,0,0,0,0,0
	.area data(ram, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.dbsym e CANIDM _CANIDM A[60:15:4]c
	.area text(rom, con, rel)
	.dbfile F:\测量模块\16MCan\can.c
	.dbfunc e can_init _can_init fV
	.even
_can_init::
	.dbline -1
	.dbline 28
; #include "main.h"
; 
; //#pragma interrupt_handler can_ReceiveData:19
; 
; /*******************************************************************
; CAN initialization:
; Mailbox 0: Receive  --> interrupt
; Mailbox 1: Transmit --> polling
; *******************************************************************/
; #define TYP_RESET		5
; #define TYP_BAUD		10
; 
; #define SELFID  2
; 
; extern unsigned char sysrst;
; unsigned char canbaud;
; 
; const Uchar CanBaud[6][3]={{0x02,0x04,0x13},{0x06,0x04,0x13},{0x0E,0x04,0x13},{0x12,0x04,0x13},{0x1E,0x04,0x13},{0x26,0x04,0x13}};
; 
; 
; 
; unsigned long CANMOBID[15]={0x1300ff01,0x1300ff01,0x02000000|(SELFID<<8),0x02000000|(SELFID<<8),0x0100ff00,0x0100ff00,0x01000000|(SELFID<<8),0x01000000|(SELFID<<8),0x0200ff00,0x12000001,0x01000000|(SELFID<<8),0x01000000|(SELFID<<8),0x01000000|(SELFID<<8),0x01000000|(SELFID<<8),0x1300ff01};
; unsigned long CANMOBMD[15]={0x1f00ffff,0x1f00ffff,0x0f00ff00,            0x0f00ff00,            0x0f00ff00,0x0f00ff00,0x0f00ff00,            0x0f00ff00,            0x0f00ff00,0x1f0000ff,0x0f00ff00,0x0f00ff00,0x0f00ff00,0x0f00ff00,0x1f00ffff};
; unsigned char CANIDT[15][4]={0};
; unsigned char CANIDM[15][4]={0};
; Uchar counterTemp;
; void can_init (void)
; {
	.dbline 29
;  canMob_init();
	xcall _canMob_init
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e canMob_init _canMob_init fV
;          temp2 -> R10,R11
;          temp1 -> R22,R23
;           temp -> y+0
;              j -> R22
;              i -> R20
	.even
_canMob_init::
	xcall push_gset3
	sbiw R28,4
	.dbline -1
	.dbline 36
;  //IDRcbufInit();
;  //RstIDused();
; }
; 
; 
; void canMob_init (void)
; {
	.dbline 43
;     unsigned char i,j;
; 	unsigned long temp;
; 	unsigned int temp1,temp2;
; 	
; 	
; 	//DDRD=(1<<PD5)|(0<<PD6);   //TXCAN, RXCNA
; 	DDRD|=0x20;
	sbi 0xa,5
	.dbline 44
; 	DDRD&=0xBF;
	in R24,0xa
	andi R24,191
	out 0xa,R24
	.dbline 45
; 	CANGCON |= (1<<SWRES);              //reset CAN interface
	lds R24,216
	ori R24,1
	sts 216,R24
	.dbline 49
;     
; 	
; 	//CANMOBID[2]=(unsigned long)(SELFID<<8)|CANMOBID[2];
; 	for(i=0;i<15;i++)
	clr R20
	xjmp L6
L3:
	.dbline 50
	.dbline 51
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANMOBID
	ldi R25,>_CANMOBID
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	ldd R17,z+1
	ldd R18,z+2
	ldd R19,z+3
	ldi R24,3
	ldi R25,0
	st -y,R24
	xcall lsl32
	std y+0,R16
	std y+1,R17
	std y+2,R18
	std y+3,R19
	.dbline 52
	ldd R22,y+0
	ldd R23,y+1
	.dbline 53
	ldd R2,y+0
	ldd R3,y+1
	ldd R4,y+2
	ldd R5,y+3
	movw R10,R4
	.dbline 54
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDT+3
	ldi R25,>_CANIDT+3
	add R30,R24
	adc R31,R25
	std z+0,R22
	.dbline 55
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDT+2
	ldi R25,>_CANIDT+2
	add R30,R24
	adc R31,R25
	movw R2,R22
	mov R2,R3
	clr R3
	std z+0,R2
	.dbline 56
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDT+1
	ldi R25,>_CANIDT+1
	add R30,R24
	adc R31,R25
	std z+0,R10
	.dbline 57
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDT
	ldi R25,>_CANIDT
	add R30,R24
	adc R31,R25
	movw R2,R10
	mov R2,R3
	clr R3
	std z+0,R2
	.dbline 58
	nop
	.dbline 59
L4:
	.dbline 49
	inc R20
L6:
	.dbline 49
	cpi R20,15
	brsh X0
	xjmp L3
X0:
	.dbline 61
; 	{
; 	 temp=CANMOBID[i]<<3;
; 	 temp1=(unsigned int)temp;
; 	 temp2=(unsigned int)(temp/0x00010000);
; 	 CANIDT[i][3]=(Uchar)temp1;
; 	 CANIDT[i][2]=(Uchar)(temp1>>8);
; 	 CANIDT[i][1]=(Uchar)temp2;
; 	 CANIDT[i][0]=(Uchar)(temp2>>8); 
; 	 NOP();
; 	}
; 	
; 	for(i=0;i<15;i++)
	clr R20
	xjmp L13
L10:
	.dbline 62
	.dbline 63
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANMOBMD
	ldi R25,>_CANMOBMD
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	ldd R17,z+1
	ldd R18,z+2
	ldd R19,z+3
	ldi R24,3
	ldi R25,0
	st -y,R24
	xcall lsl32
	std y+0,R16
	std y+1,R17
	std y+2,R18
	std y+3,R19
	.dbline 64
	ldd R22,y+0
	ldd R23,y+1
	.dbline 65
	ldd R2,y+0
	ldd R3,y+1
	ldd R4,y+2
	ldd R5,y+3
	movw R10,R4
	.dbline 66
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDM+3
	ldi R25,>_CANIDM+3
	add R30,R24
	adc R31,R25
	std z+0,R22
	.dbline 67
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDM+2
	ldi R25,>_CANIDM+2
	add R30,R24
	adc R31,R25
	movw R2,R22
	mov R2,R3
	clr R3
	std z+0,R2
	.dbline 68
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDM+1
	ldi R25,>_CANIDM+1
	add R30,R24
	adc R31,R25
	std z+0,R10
	.dbline 69
	ldi R24,4
	mul R24,R20
	movw R30,R0
	ldi R24,<_CANIDM
	ldi R25,>_CANIDM
	add R30,R24
	adc R31,R25
	movw R2,R10
	mov R2,R3
	clr R3
	std z+0,R2
	.dbline 70
	nop
	.dbline 71
L11:
	.dbline 61
	inc R20
L13:
	.dbline 61
	cpi R20,15
	brsh X1
	xjmp L10
X1:
	.dbline 73
; 	{
; 	 temp=CANMOBMD[i]<<3;
; 	 temp1=(unsigned int)temp;
; 	 temp2=(unsigned int)(temp/0x00010000);
; 	 CANIDM[i][3]=(Uchar)temp1;
; 	 CANIDM[i][2]=(Uchar)(temp1>>8);
; 	 CANIDM[i][1]=(Uchar)temp2;
; 	 CANIDM[i][0]=(Uchar)(temp2>>8); 
; 	 NOP();
; 	}
;     //reset all MObs
;     for (i=0; i<15; i++)
	clr R20
	xjmp L20
L17:
	.dbline 74
;     {
	.dbline 75
;         CANPAGE = (i<<4);           //select MOb
	mov R24,R20
	andi R24,#0x0F
	swap R24
	sts 237,R24
	.dbline 76
;         CANCDMOB = 0;           	//disable MOb
	clr R2
	sts 239,R2
	.dbline 77
;         CANSTMOB = 0;               //clear status
	sts 238,R2
	.dbline 78
;         CANIDT1 = 0;        		//clear ID
	sts 243,R2
	.dbline 79
;         CANIDT2 = 0;
	sts 242,R2
	.dbline 80
;         CANIDT3 = 0;
	sts 241,R2
	.dbline 81
;         CANIDT4 = 0;
	sts 240,R2
	.dbline 82
;         CANIDM1 = 0;            	//clear mask
	sts 247,R2
	.dbline 83
;         CANIDM2 = 0;
	sts 246,R2
	.dbline 84
;         CANIDM3 = 0;
	sts 245,R2
	.dbline 85
;         CANIDM4 = 0;
	sts 244,R2
	.dbline 86
;         for (j=0; j<8; j++)
	clr R22
	xjmp L24
L21:
	.dbline 87
	clr R2
	sts 250,R2
L22:
	.dbline 86
	inc R22
L24:
	.dbline 86
	cpi R22,8
	brlo L21

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -