LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Binary Synching Problem

Hi!

 

Following up on a recent thread I am trying to capture a Raw Binary Data Stream from an Arduino.

 

The stream from the Arduino should work like this (for clarification I attached the Arduino Code, too.):

 

- 2 bytes of 0xFF for sychronization purposes

- 512 bytes of u8 data that is converted to u16

- no checksum etc.

 

However, the Labview code doesn't seem to recognize my routine for the synchronization bytes.

 

I am fairly new to programming so please allow "room for improvement". Any ideas?

 

Thanks!

 

See the Code for the Arduino and Labview attached:

 

int x,b,i;
uint16_t buf[4][256];

void setup()
{ SerialUSB.begin(0);
while(!SerialUSB);

for(b=0; b<=3; b++)
for(i = 0; i < 256; i++)
buf[b][i] = (uint16_t)i*(b+1)*32;
}

void loop()
{
SerialUSB.write(0xFF);
SerialUSB.write(0xFF);
SerialUSB.write((uint8_t*)buf[b], 512);
b=(b+1)&3;
delay(125);
}

 

DataRecorder2.png

 

0 Kudos
Message 1 of 3
(638 Views)

I looked up the Serial.Begin() command and it looks like the argument should be a baud rate such as 9600, not a zero.  Might be that's the problem.

 

For the VI itself, what error do you get?  Is it the standard timeout error (-1073807339) or something else?

 

I don't know what other serial settings you might need to set either, you might need to try running the VISA Configure Serial Port VI and while you definitely need to turn off the termination character option, you could set the rest of the options just to be sure they're what you need them to be.

0 Kudos
Message 2 of 3
(596 Views)

 


 

However, the Labview code doesn't seem to recognize my routine for the synchronization bytes.

 


Can you give more details? Have You confirmed that a "Hello World" is transmitted correctly?

 

Guessing into the blue, you probably need to either switch to the other USB port on your Arduino Due or use the correct library (i.e., change "SerialUSB" to "Serial") for your Arduino-non-Due that does not support SerialUSB.

0 Kudos
Message 3 of 3
(574 Views)