Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how can i specify data lenght received by CANcaseXL from Vector

Status
Not open for further replies.

arras.badre

Newbie level 3
Joined
Nov 12, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
48
have some seriouse probleme with defining the data lenght of my received message obtained directly from CanCase, i know that my received msg will contain a data lenght of 20 byte but the program that i have writ accept only 8 byte as received data.


/// ******************************************************************
/// <summary>
/// RX_Thread
///
/// Description:
/// Second thread which receives data from configured receive port
/// (CANDemo_RxChannel)of XL interface.
/// </summary>
/// ******************************************************************
#region EVENT THREAD (RX)
public void RX_Thread()
{
// object to be fill with received data
XLClass.xl_event receivedEvent = new XLClass.xl_event();
// result of XL driver func. calls
XLClass.XLstatus xlStatus = XLClass.XLstatus.XL_SUCCESS;
// WaitForSingleObject values
WaitResults waitResult = new WaitResults();


// note: this thread is destroyed by MAIN
while (true)
{
// wait for hardware events
waitResult = (WaitResults)WaitForSingleObject(CANDemo_RxChannel.eventHandle, 1000);

// if event occured...
if (waitResult != WaitResults.WAIT_TIMEOUT)
{
// ...init xlStatus first
xlStatus = XLClass.XLstatus.XL_SUCCESS;

// afterwards: while hw queue is not empty...
while (xlStatus != XLClass.XLstatus.XL_ERR_QUEUE_IS_EMPTY)
{
// ...receivedata from hardware queue
xlStatus = CANDemo_RxChannel.xlReceive(ref receivedEvent);

// if receiveing succeed...
if (xlStatus == XLClass.XLstatus.XL_SUCCESS)
{
// filter various messages

{
// ...print rx data
CANDemo.XL_GetEventString(receivedEvent);
if (receivedEvent.tagData.can_Msg.id == 0x76D)
{
//Diagnostic mode of USM-CMF
if (receivedEvent.tagData.can_Msg.data[0] == Convert.ToByte(2) && receivedEvent.tagData.can_Msg.data[1] == Convert.ToByte(80) && receivedEvent.tagData.can_Msg.data[2] == Convert.ToByte(250))

{
StopRxThread(CANDemo.XL_GetEventString(receivedEvent));
}
//Serial Number of USM-CMF
if (receivedEvent.tagData.can_Msg.data[0] == Convert.ToByte(16) && receivedEvent.tagData.can_Msg.data[1] == Convert.ToByte(22) && receivedEvent.tagData.can_Msg.data[2] == Convert.ToByte(97))
{
StopRxThread(CANDemo.XL_GetEventString(receivedEvent));
}
}
}
}
}
}
// no event occured
}
}
#endregion
/// ------------------------------------------------------------------



how can i set the property o receiving the message as 20 bytes or whatever lenght i want ?

thanks a lot in advance

- - - Updated - - -

its like receiving a multi can response in the same time that have all the same ID but with different info–
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top