LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa Read and interpreting data

Hello Guys,

 

I am generating a constant hex value from an atmega mcu and passing it through the usart to my PC (Windows 7). Please see the attached VI for the data read and display procedure. I was able to overcome frame mismatch error, data overrun error etc. However, I am unable to figure out how the data is interpreted by labview? I am unable to match it with the transmitted data. The usart frame structure I am using is 1 stop bit, 8 data bits, not parity bits. I read that data is transmitted LSB->MSB by the usart. However still the data read in labview does not make sense. I tried a few data conversion from Visa read VI but none of them gave the correct data. e.g. I transmitted the value 0x65. But I am reading the data as 59. Please let me know where I am going wrong in interpreting the data.

Thank you for your help.

Download All
0 Kudos
Message 1 of 5
(2,272 Views)

I don't see anything wrong with your code. Are you certain your MCU is transmitting the right thing? What shows up if you read the serial data in Termite or TeraTerm or another terminal program?

0 Kudos
Message 2 of 5
(2,251 Views)

Thanks for the quick response BertMcMahen,

 

I tested the data transmitted from the Tx pin of mcu on CRO and I am observed that the data is correct. The continuous data transmission is a frame of 10 bits(Start,LSB->MSB,Stop). What I assumed is the "VISA configure" takes care of the start and stop bits. Please let me know if my assumption is right.

 

Thank you once again

0 Kudos
Message 3 of 5
(2,246 Views)

Yes, you're correct. Your VISA configure should be set up correctly (with the exception of the Termination Character being enabled- I'd disable that since you're not using one right now).

 

Are you using a USB-Serial converter? What model? Perhaps your voltage levels are incorrect or are inverted? Active high versus active low signals? When you say you tested the data from the pin, do you mean on an oscilloscope? (I'm not familiar with the term "CRO") Could you post your results from whatever test you've suggested?

 

Some USB-Serial converters expect TTL level serial, others expect RS-232.

 

Try running a terminal program on your LabVIEW dev machine and see what it reads. I suggest Termite:

 

https://www.compuphase.com/software_termite.htm

 

If you get the same data in Termite that you do in LabVIEW, then it's not a LabVIEW problem.

Message 4 of 5
(2,242 Views)

Hi, I was able to solve the problem with some help. I tried the serial output on a terminal and realised that there was a problem with the Putchar definition I was using in the usart code. After that was fixed the data over run error occurred, which was solved. I have attached my edited VI.

Thanks a lot for your help 

 

P.S: CRO: Cathode Ray Oscilloscope 😛 😄

0 Kudos
Message 5 of 5
(2,224 Views)