예제 #1
0
/*~+:CanManager_SendMesage_12p5ms*/
void CanManager_SendMessage_12p5ms(void)
{
	if(ResponceFlag==1)
	{
		CAN_SendFrame(pdu_handler7);
		ResponceFlag=0;
	}
}
예제 #2
0
void CAN_SendMessage_100ms(void)
{
	dummy_msg2[0]=Get_Door_Debounce_Status();
	dummy_msg2[1]=Get_Low_Beam_Lights_Status();
	dummy_msg2[2]=Get_Stop_Lights_Status();

	CAN_SendFrame(pdu_handler7);
}
예제 #3
0
int SendFrame(u8 type,u8 *pSendFrame)
{
	int iLength=0;
	switch(type){

	case OBD_TYPE_ISO:
	case OBD_TYPE_KWP:
		iLength=KWP_SendFrame(pSendFrame);
		break;
	case OBD_TYPE_VPW:
		iLength=VPW_SendFrame(pSendFrame);
		break;
	case OBD_TYPE_PWM:
		iLength=PWM_SendFrame(pSendFrame);
		break;
	case OBD_TYPE_CAN1:
	case OBD_TYPE_CAN2:
		//can_send( can_snd_id[obd_read_canid_idx], DAT_FRAME, 8, determine_pid );
		//iLength=CAN_SendFrame(pSendFrame);
		  iLength=CAN_SendFrame( can_snd_id[obd_read_canid_idx], DAT_FRAME, 8, pSendFrame+1 );
		break;
	}
	return iLength;
}
예제 #4
0
파일: tp20.c 프로젝트: bg8wj/icar-firmware
int TP20_RecvFrame(u8* pRecvFrame)
{
	u8 length,buffer[16];
	u8 bContinueFlag=1;
	u8 nOrder,nLinkCnt=0;
	u16 iLength,iRecvLen;
	u16 busy_count=0;
	u8 idle_cmd[]={0x00,0x09,0x07,0x00,0x00,0xA1,0x0F,0x64,0x9C,0x0A,0x9C};

	idle_cmd[3]=g_box.link_buff[2+1];
	idle_cmd[4]=g_box.link_buff[2+2];
	while(bContinueFlag){
		length=CAN_RecvFrame(buffer);
		if(length==0)break;
		if(length<=4){
			if(buffer[3]==0xA3){////接收链路保持贞
				Delay(g_box.f2f_time);
				CAN_SendFrame(idle_cmd);
				nLinkCnt++;
				if(nLinkCnt==10)return 0;
			}
			continue;	
		}
		if(length>=7&&buffer[6]==0x7F&&buffer[8]==0x78){
			busy_count++;
			nOrder=buffer[3];
			g_box.link_buff[2+3]=0xB0+(((nOrder&0x0F)+1)&0x0F);
			Delay(g_box.f2f_time);
			CAN_SendFrame(g_box.link_buff);	
			g_box.link_buff[2+3]=0xA3;
			if(busy_count==g_box.busy_count){
				AddFrameToBuffer(buffer,length);
				return 1;
			}
			continue;
		}												
		if((length>7)&&(buffer[3]==0xA1)){//接收到等待贞
			AddFrameToBuffer(buffer,length);
			return 1 ;
		}
		if(buffer[4]&0x80)bContinueFlag=1;
		else bContinueFlag=0;

		iRecvLen=length-6;//已接收的长度
		iLength=(buffer[4]&0x0f)*256+buffer[5]; //需要接收的长度
		nOrder=buffer[3];
		AddFrameToBuffer(buffer,length);
		while(iRecvLen<iLength){
			length=CAN_RecvFrame(buffer);
			if(length==0)break;
			else{
				iRecvLen+=(length-4);
				nOrder=buffer[3];
				AddFrameToBuffer(buffer,length);
			}
		}						
		g_box.link_buff[2+3]=0xB0+(((nOrder&0x0F)+1)&0x0F);
		Delay(g_box.f2f_time);
		CAN_SendFrame(g_box.link_buff);	
		g_box.link_buff[2+3]=0xA3;
	}
	return 1;
}
예제 #5
0
void Can_Manager_PduHandler0(CAN_MessageDataType CanMessage)
{
	CanMessage_PduHandler0 = CanMessage;
	CAN_SendFrame(pdu_handler1);
	PduHandlerCnt0++;
}
예제 #6
0
void CanManager_SendMsg()
{
	
	CAN_SendFrame(pdu_handlerMsg1);

}
예제 #7
0
void CanManager_SendResponse()
{
	CAN_SendFrame(pdu_handler1);
}
예제 #8
0
/*~+:Public Operations*/
void CanManager_SendRequest()
{
	
	CAN_SendFrame(pdu_handlerREQ);

}