Home > Software > Programming and SDK > Forum > DI-245 Comm Protocol "chn" command

DI-245 Comm Protocol "chn" command

May 14, 2015
John Vong wrote
I am writing a C#.Net application to be used with the DI-245 and am having difficulty adding more than 2 channels to the scan list using the "chn" command. My goals is this:
1. Enable analog channel 0 to measure an T type TC as the first scan list member
2. Enable analog channel 1 to measure +- 2.5 V as the second scan member
3. Enable analog channel 2 to measure +- 2.5 V as the third scan member

When I add 3 channels or more to the scan list as shown below I dont get back correct values:

serialPort.WriteLine("chn 0 5888");
serialPort.WriteLine("chn 1 3073");
serialPort.WriteLine("chn 2 3074");

But if I only do two channels such as below it works:
serialPort.WriteLine("chn 0 5888");
serialPort.WriteLine("chn 1 3073");

Any help would be appreciated.


Reply
3 Answers
May 14, 2015
Ioan agent wrote
Could you please also include all other commands issued to provide context? How do you determine the values to be correct/incorrect?

The first thing to check is whether you are parsing the data coming back "on the correct boundary". For example, you can use the LSB of every byte in a scan in binary mode to ensure you start parsing a scan correctly.

Also, the number of enabled channels affects your sample rate (since you're testing 2 vs 3 channels).
May 14, 2015
Ken agent wrote
Your "chn" commands appear correct. Do all four channels work in WinDaq acquisition if you set them up as desired. If not, the DI-245 has a hardware problem.

Does your program wait for the echo of each command before sending the next? If not, setting up the first two channels might cause the device to miss the third. WinDaq waits for the echoes and makes sure that they agree with what is sent, taking into account that the return terminator can echo as a space. The DATAQ SDK .Net Class Library sleeps for 100 ms after sending each command.
May 14, 2015
John Vong wrote
I found the problem and you were correct the error was in the way I was parsing the packets. Thanks for you input.