DI-1100 Misaligned Byte Sampling

DI-1100 Misaligned Byte Sampling

I'm having a problem correctly segmenting the series of bytes from the DATAQ instrument. The interpreted first pair of bytes may not represent CH1, and the pairs of bytes can be misaligned as well.

My setup is,
DI-1100 in CDC mode
CH1 connected to 4-20mA source with 4-20mA current loop shunt resistor
no other wire terminals connected
pyserial to send and receive data
receiving and displaying data from CH1-4 and digital

The DI_1100.py sample code almost always works correctly. The only times the sample code has not worked is directly after running my own code.

Trying to incorporate the sample code into my own application results in the below behavior. The vertical dots represent lines that have been removed for brevity. The correct voltage is about 1.34V in CH1 corresponding to zero force on the sensor. The code is called press_gui.py because the analog data is from the force exerted by a hydraulic press. Changes in voltage are due to applied pressure on the sensor outputting 4-20mA. I have notes with my best guess to explain the output.

I'm most interested in best practices for reading the serial data in my python code. I can try to detect the correct pairs of bytes by looking for a correct calculated voltage, but I'd like to understand why the sample code does not have this problem. Simpler is better, so a solution that acquires all data at the device sampling rate in CH1 with correct alignment is fine with me.

### Correct output in CH1 eventually followed by byte misalignment and incorrect digital ###
### Force is applied to the sensor during misalignment shown in CH3, but showing in all outputs ###
C:\Users\Surface2\Documents>python press_gui.pyw
[1.34276123046875, -0.001129150390625, 0.001068115234375, 0.00101318359375, 0]
[1.34266357421875, -0.0012054443359375, 0.000946044921875, 0.000946044921875, 0]
.
.
.
[1.342724609375, -0.000689697265625, 0.000958251953125, 0.0007080078125, 0]
[1.0585205078125, 0.196942138671875, 1.3993011474609376, -0.1565399169921875, 3]
[0.47874755859375, 0.277313232421875, 3.8311767578125, -0.36043701171875, 0]
[0.2990478515625, 0.2304107666015625, 3.8397613525390626, -0.25653076171875, 3]
.
.
.
[0.318505859375, 0.3702362060546875, 3.7913909912109376, -0.44324951171875, 3]
[0.4044921875, 0.306182861328125, -1.196923828125, -0.242218017578125, 3]
[0.226416015625, 0.30145263671875, -9.107867431640624, -0.3507568359375, 3]
[0.29896240234375, 0.2991302490234375, -9.232077026367188, -0.3460693359375, 3]
[0.34921875, 0.2882080078125, -9.066464233398438, -0.2445068359375, 3]
[0.32886962890625, 0.235870361328125, 4.807745361328125, -0.2322418212890625, 3]
[0.27781982421875, 0.2718475341796875, 3.7554351806640627, -0.48387451171875, 3]
[0.40303955078125, 0.361669921875, 3.7054351806640624, -0.32606201171875, 3]

### Misalignment in CH2, but showing in all outputs ###
C:\Users\Surface2\Documents>python press_gui.pyw
[0.135712890625, 1.534862060546875, -0.14117645263671874, 0.9467819213867188, 0]
[0.290823974609375, 3.7491790771484377, -0.28285888671875, 0.3247735595703125, 0]
[0.259990234375, 3.77306640625, -0.29840576171875, 0.34312469482421876, 0]
[0.28759765625, 3.752993469238281, -0.25442138671875, 0.34509185791015623, 3]

### CH1 data correctly displayed in CH4 with incorrect digital ###
C:\Users\Surface2\Documents>python press_gui.pyw
[-0.001708984375, 0.0015380859375, 0.0008575439453125, 1.296826171875, 1]
[-0.0010986328125, 0.0009735107421875, 0.001007080078125, 1.342724609375, 0]
[-0.0016357421875, 0.0008575439453125, 0.0009429931640625, 1.34259033203125, 3]
[-0.00179443359375, 0.001043701171875, 0.0012786865234375, 1.342529296875, 2]
[-0.00174560546875, 0.0015228271484375, 0.0013702392578125, 1.3430908203125, 1]
[-0.0013427734375, 0.00126953125, 0.00091552734375, 1.34263916015625, 0]
[-0.00155029296875, 0.000994873046875, 0.000830078125, 1.342578125, 1]
[-0.00162353515625, 0.0013671875, 0.0009429931640625, 1.342626953125, 1]
[-0.001220703125, 0.0012542724609375, 0.0009857177734375, 1.342822265625, 0]
[-0.0017333984375, 0.0012359619140625, 0.0008819580078125, 1.342529296875, 2]
[-0.00198974609375, 0.00078125, 0.0007415771484375, 1.34228515625, 2]
[-0.00179443359375, 0.0013824462890625, 0.0011138916015625, 1.3425048828125, 2]
[-0.00147705078125, 0.0014068603515625, 0.0010345458984375, 1.3430908203125, 0]
[-0.00098876953125, 0.0012237548828125, 0.00111083984375, 1.3427978515625, 1]
[-0.001611328125, 0.000927734375, 0.0009979248046875, 1.34241943359375, 0]