Board logo

标题: 有哪位用过CANoe? [打印本页]

作者: ezekyal    时间: 2007-5-15 10:55     标题: 有哪位用过CANoe?

我编写的收发程序,用CANoe模拟仿真,但是接收不到我发送的数据,总线负载率也很高,提示有接收错误,是不是程序出什么问题了,烦请版主给看看。
/*
** ###################################################################
**
** Filename : MotorCan.C
**
** Project : MotorCan
**
** Processor : MC9S12DP256BCPV
**
** Version : Driver 01.01
**
** Compiler : Metrowerks HC12 C Compiler
**
** Date/Time : 27.11.2002, 11:53
**
** Abstract :
**
** Main module.
** Here is to be placed user's code.
**
** Settings :
**
**
** Contents :
**
** No public methods
**
**
** (c) Copyright UNIS, spol. s r.o. 1997-2002
**
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
**
** http : www.processorexpert.com
** mail : info@processorexpert.com
**
** ###################################################################
*/
/* MODULE MotorCan */

/*Including used modules for compilling procedure*/
#include "Cpu.h"
#include "Events.h"
#include "CAN1.h"
#include "Term1.h"
#include "Inhr1.h"
/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"

int speed,throttle; //以及其它参数
dword MessageID, *id;
byte BufferNum,FrameType,Length,*Data,*FrameFormat,*lon,*Frametp;
void main(void)
{
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
CAN1_Init();
/*** End of Processor Expert internal initialization. ***/
for(;!CAN1RFLG_RXF;)
{Length=2; FrameType == DATA_FRAME;
{speed=0xF3;MessageID=0x0CF00400; //发动机转速
Data[0]=(speed>>8);Data[1]=((speed&0xF0)>>8);
CAN1_SendFrame(BufferNum,MessageID,FrameType,Length,Data);
}

{throttle=0x9A;MessageID=0x0CF00300; //油门位置
Data[0]=(throttle>>8);Data[1]=((throttle&0xF0)>>8);
CAN1_SendFrame(BufferNum,MessageID,FrameType,Length,Data);
}
}



CAN1_ReadFrame(id,Frametp,FrameFormat,lon,Data);
CAN1_OnFreeTxBuffer(BufferNum);
}

/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/

/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
/*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/


/* END MotorCan */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 03.08 for
** the Motorola HCS12 series of microcontrollers.
**
** ###################################################################
*/





欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0