资源简介
该为CCP协议的源代码,包括命令处理机和DAQ处理机,符合CCP2.1标准。集成到单片机后可以与上位机软件CANape等进行标定。
代码片段和文件信息
typedef struct ccpOdtEntry {
unsigned char *ptr;
} ccpOdtEntry_t;
typedef ccpOdtEntry_t ccpODT_t[7];
typedef struct ccpDaqList {
ccpODT_t odt[3];
unsigned short prescaler;
unsigned short cycle;
unsigned char eventChannel;
unsigned char last;
unsigned char flags;
} ccpDaqList_t;
typedef struct {
unsigned char b[8];
} ccpMsg_t;
typedef struct {
unsigned char len;
unsigned char rp;
ccpMsg_t msg[(3 * 2)];
} ccpQueue_t;
struct ccp {
unsigned char Crm[8];
unsigned char SessionStatus;
unsigned char SendStatus;
unsigned char * MTA[2];
ccpQueue_t Queue;
ccpOdtEntry_t *DaqListPtr;
ccpDaqList_t DaqList[2];
unsigned char UserSessionStatus;
unsigned short CheckSumSize;
};
extern struct ccp ccp;
extern void ccpInit(void);
extern void ccpDaq(unsigned char eventChannel);
extern void ccpCommand(unsigned char * msg);
extern unsigned char ccpSendCallBack(void);
void ccpSendCrm(void);
extern unsigned char ccpBackground(void);
extern void ccpSend(unsigned char * msg);
extern void ccpUserBackground(void);
extern unsigned char * ccpGetPointer(unsigned char addr_ext unsigned long addr);
unsigned char ccpStationId[] = “ECU00001“;
struct ccp ccp;
void ccpSendCrm(void) {
;
if (ccp.SendStatus&(0x20 | 0x10 | 0x40)) {
ccp.SendStatus |= 0x01;
}
else {
ccp.SendStatus |= 0x10;
ccpSend(ccp.Crm);
}
;
}
void ccpQueueInit(void) {
ccp.Queue.len = 0;
ccp.Queue.rp = 0;
}
unsigned char ccpQueueWrite(ccpMsg_t *msg) {
if (ccp.Queue.len >= (3 * 2)) return 0;
ccp.Queue.msg[(ccp.Queue.rp + ccp.Queue.len) % (3 * 2)] = *msg;
ccp.Queue.len++;
return 1;
}
static unsigned char ccpWriteMTA(unsigned char n unsigned char size unsigned char * d) {
while (size-->0) {
*(ccp.MTA[n]) = *d;
ccp.MTA[n]++;
d++;
}
return 1;
}
static void ccpReadMTA(unsigned char n unsigned char size unsigned char * d) {
while (size-->0) {
*d = *(ccp.MTA[n]);
d++;
ccp.MTA[n]++;
}
}
static unsigned char ccpClearDaqList(unsigned char daq) {
unsigned char * p;
unsigned char * pl;
if (daq >= 2) return 0;
p = (unsigned char *)&ccp.DaqList[daq];
pl = p + sizeof(ccpDaqList_t);
while (p ccp.SessionStatus |= 0x02;
ccpQueueInit();
return 3;
}
static unsigned char ccpPrepareDaq(unsigned char daq unsigned char last unsigned char eventChannel unsigned short prescaler) {
if (daq >= 2) return 0;
ccp.DaqList[daq].eventChannel = eventChannel;
if (prescaler == 0) prescaler = 1;
ccp.DaqList[daq].prescaler = prescaler;
ccp.DaqList[daq].cycle = 1;
ccp.DaqList[daq].last = last;
ccp.DaqList[daq].flags = 0x04;
return 1;
}
static unsigned char ccpStartDaq(unsigned char daq
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10217 2017-11-19 08:38 CCP.c
- 上一篇:连连看游戏的设计思路文档
- 下一篇:Qt类继承关系图
相关资源
- Qt creator 做的计算器工程文件
- 89C51 单片机IO 口模拟串行通信的实现
- 仿VS2010风格的toolbox抽屉控件(源码)
- 企业人事档案管理系统全套带源码
- 基于插件式的开发框架源码
- 2019最新vip影视网站app源码40套带后台
- jmeter源码介绍 二次开发参考
- http访问模块源码.e
- 隐藏文件的驱动源码和控制台源码
- ExtJS日期多选组件源码
- 微信62数据源码
- AT89C51单片机在直流电机闭环调速系统
- c8051f系列单片机PCA实现PWM波输出
- 教育教学资源库系统 系统源码 论文
- ADC0809模数转换与显示(汇编程序)
- 基于单片机的按摩器的毕设
- 单片机程序加密的几种实用方法
- Delphi7高级应用开发随书源码
- 钓鱼管理系统
- 使用rle(run length encoding)编码的(
- 控件自适应窗体
- 单片机8-16位曼彻斯特编码
- 易语言做抽奖程序源码
- 16x16汉字点阵字库,单片机编程用
- 51单片机SPWM输出程序
- PL/0语言编译器源码及测试程序
- 基于单片机全自动洗衣机毕业设计
- 基于51单片机的PWM直流电机调速prote
- PB抽奖程序源码,无需链接数据库
- 51单片机的OV7670摄像头驱动程序
评论
共有 条评论