Manual
DOC101356-1_ - rev 2 – 2013-09-24 - Created by:6644
Page 11 of 24
Hatteland Display AS, Åmsosen, N-5578 Nedre Vats, Norway
Tel: (+47) 4814 2200 - mail@hatteland-display.com - www.hatteland-display.com
HD CAN Module Programmer’s Guide (Linux)
All intellectual properties belongs to Hatteland Display AS
/**************************************************************************
**********//**
* @brief Function to Write Messages
***************************************************************************
************/
static void callPassThruWriteMsgs()
{
unsigned int id = 0x10;
unsigned long msgNum = 1;
unsigned long *msgNumPtr = &msgNum;
unsigned int dlc = 1;
J2534_ConnectFlags txFlags;
unsigned long timeout = 0;;
int addrSel;
int chanSel;
int msgPtrSel;
int msgNumPtrSel;
int protoSel;
PASSTHRU_MSG *txPassThruMsgPtr = txPassThruMsg;
//"Enter protocol (0-J1850VPW, 1-J1850PWM, 2-ISO9141, 3-ISO14230, 4-
CAN, 5-ISO15765, "
// "6-SCI_A_ENGINE, 7-SCI_A_TRANS, 8-SCI_B_ENGINE, 9-
SCI_B_TRANS): ";
protoSel = 4;
//Set message Data
txPassThruMsg[0].Data[ID_BYTES_NUM + 0] = static_cast<unsigned
char>(0x12);
//Standard message length
txFlags.bits.Can29BitId = 0;
txPassThruMsg[0].TxFlags = txFlags.value;
txPassThruMsg[0].DataSize = dlc + ID_BYTES_NUM;
txPassThruMsg[0].ProtocolID = static_cast<J2534_PROTOCOL>(protoSel +
1);
for (unsigned int i = 0; i < msgNum; i++)
{
txPassThruMsg[i] = txPassThruMsg[0];
txPassThruMsg[i].Data[0] = static_cast<unsigned char>(id >>
24);
txPassThruMsg[i].Data[1] = static_cast<unsigned char>(id >>
16);
txPassThruMsg[i].Data[2] = static_cast<unsigned char>(id >> 8);
txPassThruMsg[i].Data[3] = static_cast<unsigned char>(id >> 0);
id++;
}
//Send Message via Channel_1
PassThruWriteMsgs(channel_1, txPassThruMsgPtr, msgNumPtr, timeout);
}
/**************************************************************************
**********//**
* @brief Function to start msg filter