资源简介
CAN,SPI,I2C,USB2.0,422,485总线资料
代码片段和文件信息
#include
#include
#include
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define NBTR0 0x30
#define NBTR1 0x31
#define AMRBF 0x32
#define ACRBF 0x36
#define TXBF 0x40
#define MODE 0x0F00
#define CMR 0x0F01
#define SR 0x0F02
#define IR 0x0F03
#define IER 0x0F04
#define BTR0 0x0F06
#define BTR1 0x0F07
#define OCR 0x0F08
#define ALC 0x0F0B
#define ECC 0x0F0C
#define EWLR 0x0F0D
#define RXERR 0x0F0E
#define TXERR 0x0F0F
#define TXB 0x0F10
#define RXB 0x0F10
#define ACR 0x0F10
#define AMR 0x0F14
#define RMC 0x0F1D
#define RBSA 0x0F1E
#define CDR 0x0F1F
sbit RES=P1^0;
sbit lamp=P1^1;
/*****************************DELAY*******************************/
void delay(uint i)
{uint j;
for(j=0;j }
/***************************SJA1000_INIT**************************/
void sja1000_init(void)
{uchar clear;
delay(1000);
XBYTE[MODE]=0x0D;
XBYTE[CDR]=0x88;
XBYTE[IER]=0x0d;
XBYTE[AMR]=0xff;
XBYTE[AMR+1]=0xff;
XBYTE[AMR+2]=0x0;
XBYTE[AMR+3]=0x0;
XBYTE[ACR]=0xea;
XBYTE[ACR+1]=0x20;
XBYTE[BTR0]=0x00;
XBYTE[BTR1]=0x1c;
XBYTE[OCR]=0xAA;
XBYTE[RBSA]=0x0;
XBYTE[TXERR]=0x0;
clear=XBYTE[ECC];
XBYTE[MODE]=0x0C;
}
/*************************receive array data*****************************/
void received()
{uint i;
uchar accbccc;
uchar a[14];
bcc=XBYTE[SR];
while(bcc&0xc3)
{
if(bcc&0x80)
{
acc=XBYTE[IR];
XBYTE[MODE]=0x08;
delay(1000); ///to wait for BUS entering into normal mode
continue;
}
else if(bcc&0x08)
{
XBYTE[CMR]=0x0c;
continue;
}
else if(bcc&0x01)
{
lamp=0;
a[0]=XBYTE[RXB];
c=a[0];
c=c%16;
c=c+4;
for(i=1;i {
a[i]=XBYTE[RXB+i];
}
XBYTE[CMR]=0x04;
}
bcc=XBYTE[SR];
}
acc=XBYTE[ALC];
acc=XBYTE[ECC];
}
/*************************STATE Analyse*****************************/
void sstate()
{ uchar acc;
acc=0xff;
while(acc&0x10)
{
acc=XBYTE[SR];
}
acc=0xff;
while(!(acc&0x08))
{
acc=XBYTE[SR];
}
acc=0xff;
while(!(acc&0x04))
{
acc=XBYTE[SR];
}
}
/*******************************send data**********************************/
void send_data()
{
XBYTE[TXB]=0x07;
XBYTE[TXB+1]=0xEA;
XBYTE[TXB+2]=0x20;
XBYTE[TXB+3]=0xA3;
XBYTE[TXB+4]=0xA3;
XBYTE[TXB+5]=0xA3;
XBYTE[TXB+6]=0xA3;
XBYTE[TXB+7]=0xA3;
XBYTE[TXB+8]=0xA3;
XBYTE[TXB+9]=0xA3;
XBYTE[CMR]=0x010;
}
/***
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 643072 2003-11-21 00:00 422485.pdf
目录 0 2011-03-14 16:52 i2c\
文件 590152 2011-03-14 16:49 i2c\24c02数据手册.PDF
文件 865280 2007-05-21 13:00 i2c\chinesi2c.pdf
文件 371443 2007-07-09 23:51 i2c\i2c.bus.specification.pdf
文件 4942289 2008-01-11 14:28 i2c\I2C.Manual.pdf
文件 228522 2011-03-10 10:01 i2c\I2C协议.pdf
文件 614351 2006-07-01 06:03 i2c\smbus.specification.pdf
目录 0 2011-03-31 11:29 SJA1000\
文件 2032128 2011-02-14 14:06 SJA1000\4.2_CAN通信控制器SJA1000.ppt
目录 0 2003-05-13 16:14 SJA1000\BasicCAN _V1\
目录 0 2003-05-13 16:14 SJA1000\BasicCAN _V1\BasicCAN _V1\
目录 0 2003-05-13 16:14 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\
文件 821 2002-10-14 13:01 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\SJA.Opt
文件 0 2002-10-14 13:01 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\SJA.plg
文件 1689 2002-09-18 15:48 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\SJA.Uv2
文件 19154 2002-07-31 09:32 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\SJA_BCANCONF.ASM
文件 12415 2002-07-31 13:37 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\SJA_BCANDEMO.ASM.ASM
文件 28786 2002-07-31 13:36 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\SJA_BCANFUNC.ASM
文件 12199 2002-09-18 13:45 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\test2.ASM
文件 12507 2002-09-19 10:58 SJA1000\BasicCAN _V1\BasicCAN _V1\A测试程序\Test3.ASM
目录 0 2003-05-13 16:14 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\
目录 0 2003-05-13 16:14 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\
文件 6776 2002-08-01 11:00 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA
文件 2883 2002-08-01 11:00 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA.hex
文件 51 2002-08-01 11:00 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA.lnp
文件 23776 2002-08-01 11:00 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA.M51
文件 1177 2002-10-27 13:36 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA.Opt
文件 0 2002-10-27 13:36 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA.plg
文件 1705 2002-08-01 11:02 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA.Uv2
文件 19153 2002-10-27 13:36 SJA1000\BasicCAN _V1\BasicCAN _V1\BasicCAN_V1.0\a51\SJA_BCANCONF.ASM
............此处省略49个文件信息
评论
共有 条评论