Bytes at serial port dropping bytes 
Author Message
 Bytes at serial port dropping bytes

Hi there,

I've created a VI that sends serial data out to a system and then
receives data back from the same system. When receiving the data back,
I use the Bytes At Serial Port sub-vi because the received bytes
varies between 27 and 3 (controlled with a switch).

The problem I'm having is when I run the VI while receiving 27 bytes,
during the FIRST loop, the Bytes at Serial Port sub-vi always yields
the last 19 bytes. It seems like it's just dropping the first 8 bytes
as if it didn't have enough preparation time. The second loop through
it picks up the 27 bytes as expected. Does anyone know of this
problem? Thanks!

Mon, 26 Sep 2005 01:49:52 GMT  
 Bytes at serial port dropping bytes
Hi Bonehomme,

after you have initialized the serial port you are able to send and
receive data. If you send data to a system and then enter a loop to
check how much bytes you have received you will get an increasing
number from Bytes at Serial Port.
You are sending data to a system with Serial Write. After that your
system needs some time to read the data and create an answer. Also it
takes some time to transfer the data back to your PC (at 9600 Baud it
needs 1 millisecond per byte). Meanwhile your program enters the loop
and checks how much data has been received until now. Dependig on the
timings it could be that you will see 19 bytes and on the next
iteration 27.
Bytes at Serial Port cannot drop any bytes, because it gives you only
the number of bytes you have received.
If you are using the VISA serial functions and do binary serial
transfer you have also to disable the termination character handling.


Mon, 26 Sep 2005 03:47:29 GMT  
 Bytes at serial port dropping bytes
I would wonder if your initialization to the serial port is in the
same loop as the data collection - I built a serial data system
recently, and had similar problems until I moved all the
initialization stuff forward, and the serial read loops back towards
the end of the vi.  Also, I found at 9600 baud (the speed of my D/A
system) that I needed a 30ms timer in front of serial read vi's to
give the system enough time to receive data.
Try placing a timer (30 ms as example) into the vi and see if that
helps. Might need longer (or shorter) times too.

Mon, 26 Sep 2005 04:14:47 GMT  
 [ 3 post ] 

 Relevant Pages 

1. serial communication dropping bytes?

2. Writing bytes out of Serial Port

3. How do you send bytes at serial port?

4. Read specified bytes at Serial port

5. A little gift (Hex to Byte/Byte to Hex)

6. I want to generate a CRC (2 bytes) and I have 31 bytes in my frame

7. Byte Array to Byte

8. Hi byte and Lo Byte Question

9. high-bytes low-bytes?

10. Reading bytes from a certain offset in order to search for bytes

11. Converting big-endian byte to small-endian byte

12. Converting big-endian byte to small-endian byte


Powered by phpBB® Forum Software