@ Dave McLaughlin -
Thank you for your advice, but , ahhhhh, I don’t know where to find anything in the software about sampling point. Actually, I checked all buttons, but no sampling point.
If it is possible, could you give me some codes to test, which run well in your computer. Just very simple one is OK, like send or receive a complete can.message…
Thank you~~~
But in my personal opinion, it could not be the program problem, because, when even though I wrote a very simple one like follow, this data received event does not raise, when I transmit messages from Can analyzer to G120
can_dw2.InitializeCAN(15, 8, 20);
can_dw2.DataReceived += new GTM.GHIElectronics.CAN_DW.DataReceivedEventHandler(can_dw2_DataReceived);
can_dw2.ErrorReceived += new GTM.GHIElectronics.CAN_DW.ErrorReceivedEventHandler(can_dw2_ErrorReceived);
can_dw2.PostDone += new GTM.GHIElectronics.CAN_DW.PostMessagesDoneEventHandler(can_dw2_PostDone);
can_dw2.msgList = new GHI.Premium.Hardware.CAN.Message[15];
for (int i = 0; i < can_dw2.msgList.Length; i++)
{
can_dw2.msgList[i] = new GHI.Premium.Hardware.CAN.Message();
can_dw2.msgList[i].ArbID = 0x11;
can_dw2.msgList[i].DLC = 0x01;
can_dw2.msgList[i].Data[0] = (byte)i;
can_dw2.msgList[i].IsEID = false;
can_dw2.msgList[i].IsRTR = false;
Debug.Print(can_dw2.msgList[i].ArbID.ToString() + can_dw2.msgList[i].DLC.ToString() + can_dw2.msgList[i].Data[0].ToString());
Thread.Sleep(500);
}
int numberOfMsgSent = 0;
//Send all of the messages
while (true)
{
// Post as many messages as possible.
can_dw2.PostMessages(0, can_dw2.msgList.Length - numberOfMsgSent);
// Record how many were sent.
numberOfMsgSent += can_dw2.NumMessagesSent;
// If we have sent all of the messgaes, break out of the loop.
if (numberOfMsgSent == can_dw2.msgList.Length)
break;
// Sleep to allow the messages time to transmit.
System.Threading.Thread.Sleep(1);
}
}
void can_dw2_PostDone(int numPosted)
{
Debug.Print(numPosted.ToString() + " messages were posted");
}
void can_dw2_ErrorReceived(GHI.Premium.Hardware.CAN sender, GHI.Premium.Hardware.CANErrorReceivedEventArgs args)
{
Debug.Print("CAN error received: " + args.Error.ToString());
}
void can_dw2_DataReceived(GHI.Premium.Hardware.CAN sender, GHI.Premium.Hardware.CANDataReceivedEventArgs args)
{
Debug.Print("nice");
}
Another question, since I have a CAN_DW module, I don’t need to define a CAN channel, right? In order to initialization a CAN with 125kb/s, I just need the following codes? Is it enough?
can_dw2.InitializeCAN(15, 8, 20);
Looking forward for your reply, I am Crazzzzzy~~~~