LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

prob whille getting the bytes at serial port in serial communication

Solved!
Go to solution

Hi all,

 

I an using the serial write vi to send the command to the instrument. the response i get is read usin the read vi. i am using in between read and write the serial bytes at port to accumulate the bytes. bu what i have observed is quite strange. when i run the vi with the debugger on, i could c that the bytes at serial port is 201 and what i get in read buffer is only 133.

 

can any1 guess out what the prob would b??..

 

0 Kudos
Message 1 of 5
(1,271 Views)

Hi,

 

Try to put a time delay between your read and write modules say 1000ms. You will get the full data i suppose by doing this. Let me know if it works..


Regards,


Nitzz

(Kudos are always WelcomeSmiley Wink)

0 Kudos
Message 2 of 5
(1,263 Views)

ya i have already put the delay of 2000 msec. what i m tryin to say is i am expecting 201 bytes from the serial port.. and with the degugger i can c that there are 201 bytes at the port. but what i get in the read buffer is only of 133 bytes. the data i collect in the read buffer, i convert into array using string to byte array.

 

i am ttaching the snapshot of what happens...

0 Kudos
Message 3 of 5
(1,257 Views)
Solution
Accepted by topic author saki
08-27-2015 04:09 PM

You don't show the VISA Configure Serial Port function but I'm guessing you have the termination character enabled. A read will automatically terminate when the character is detected and you should never enable it when you are trying to read hex.

Message 4 of 5
(1,247 Views)

Placing a delay is not the solution.

 

Have a look at the code snippet that I posted here:

http://forums.ni.com/t5/LabVIEW/Reading-time-interval-of-serial-port/m-p/1529140#M568806

 

The modified code is also attached in that post. 

 

The solution is to place the serial read inside a loop which continues to read until there is no more data in the buffer. 

 

______________________________________________________________________
0 Kudos
Message 5 of 5
(1,243 Views)