为什么我电脑检测不到CAN通讯发送的报文?,首先板子是绝对没问题的!!
程序如下:
#include"stm8s.h"
#include<stdio.h>
int main( void )
{
CLK_HSICmd(ENABLE);
CLK_PeripheralClockConfig(CLK_PERIPHERAL_CAN, ENABLE);
CAN_DeInit();
CAN_Init(CAN_MasterCtrl_AllDisabled, CAN_Mode_Normal, CAN_SynJumpWidth_1TimeQuantum, CAN_BitSeg1_8TimeQuantum, CAN_BitSeg2_7TimeQuantum,2);
CLK_HSICmd(ENABLE);
CAN_FilterInit(CAN_FilterNumber_0, ENABLE, CAN_FilterMode_IdMask, CAN_FilterScale_32Bit, 0, 0, 0, 0, 0, 0, 0, 0);
u8 data[8];
data[0]=0x11;
data[1]=0x22;
data[2]=0x33;
data[3]=0x44;
data[4]=0x55;
data[5]=0x66;
data[6]=0x77;
data[7]=0x88;
CAN_Transmit(0x12, CAN_Id_Standard, CAN_RTR_Data, 0x07, data);
}
电脑检测不到报文!!
|