Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

getting correct data from the serial device

I am using labview 8.6. I use VISA to get data from my serial device.am facing a problem of not getting a correct information from my device.currently i dont have a device so am just using another PC to get data from hyperterminal but the problem is what i write in the hyperterminal is not what i receive in my VISA read.there are some data which are lost so i dont get a correct information.i started with configuring my serial port,then VISA write,then VISA read,then i closed the session.configurations at the configure serial port VI matches with those in hyperterminal

0 Kudos
Message 1 of 13
(4,609 Views)

Precisely how 'incorrect' is the data? What is the data that is lost? Typically in this sort of test, your read would be in a loop where you use the VISA Bytes at Serial Port.

0 Kudos
Message 2 of 13
(4,606 Views)

what i mean by saying incorrect data is,example i write the sentense "im going to school" at the read buffer in VISA read vi i wont get the whole sentense,i can get "im going t" the other segment of the sentense is lost.I have put my VISA read vi in a while loop

0 Kudos
Message 3 of 13
(4,596 Views)

You probably read too soon, or you are opening and closing your serial port inside the while

greetings from the Netherlands
0 Kudos
Message 4 of 13
(4,591 Views)

One parameter to be taken into consideration is the "timeout" in VISA and if its configured correctly, then the data you are getting is either the NRdata or an unformatted ASCII type data. something like this -- #FFA4@fhxf$#$# which you need to convert properly.

0 Kudos
Message 5 of 13
(4,587 Views)

Actually am using a default timeout which is ten seconds,but when using another PC sending something using hyperterminal i get timeout error and i dont know how to solve this, or should i increase the timeout?may be someone could help me on how the output from the serial device and the timeout relate.

0 Kudos
Message 6 of 13
(4,582 Views)

Hi nnko,

 

Maybe if you post this segment of your code, we would be able to help you out a little bit better. Also, you could always try an NI-SPY capture to see if all of your characters are making it to the VISA driver.

Cheers!

TJ G
0 Kudos
Message 7 of 13
(4,574 Views)

That timeout error will not cause any trouble, i  tried sending and receiving data serially using hyperterminal and i got the data transmitted properly. I dont know why you are unable to tx/rx data.

 

Do one thing, just store/save the data in a TDM file thats coming in and analyse it.

 

You can use DIAdem for that purpose.

0 Kudos
Message 8 of 13
(4,569 Views)

what am facing right now is,i want to save readings from my serial device which gives readings every after ten seconds and it give out 4 bytes each time. I have set a byte count in my VISA read to file vi equal to 4 and i have put VISA write,VISA read and VISA read to file in the same loop. I have chosen notepad to be my file to save readings from my device. but the problem is example firstly my device give the output of 3423 it will be saved into my notepad but after ten second when another reading come let say 4567,the first one is overwritten and this will go on continously so my notepad will be saving just the last readings from my device. what should i do to solve this?

0 Kudos
Message 9 of 13
(4,543 Views)

What am facing right now is i want to save measurements from my device in a notepad.my device gives out 4 bytes every after ten seconds. in VISA read To File vi i have chosen byte count to be 4. The problem is example the first reading from my device is 3234 it will be received and it will be saved in a notepad file.but when the second reading come it will overwrite the previous one so the notepad will be saving just the last reading. I have put VISA write,VISA read and VISA read to file VIs in the same loop. the timeout is ten seconds. so what should i do so that i will be able to save all data in a notepad without overwritting?

0 Kudos
Message 10 of 13
(4,541 Views)