LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with data sent with VISA communication

Solved!
Go to solution

Hello,

I will explain the things clearly

Transmitter section:

The receiver(Microcontroller) needs this data to respond 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0x0D.So,from Labview I need to send this data.

Receiver section:

In return the receiver(Microcontroller) sends the data to transmitter in this format

 0x01 0x02 <18 bytes of information data> 0x03 0x0D.Later, the information will be post proecessed.

 

Can someone explain me clearly of what to send from Labview VISA so that the receiver recieves this data 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0x0D.

Thanks.

 

 

0 Kudos
Message 11 of 46
(1,130 Views)

And the communication protocol of says

e.g, to write a value of 0x456789 to address 0x12, message format is
“0x02 0x31 0x32 0x34 0x35 0x36 0x37 0x38 0x39 0x0D”

 

To send  0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0x0D from Labview what should be sent ?

can someone clearify this as well.

 

0 Kudos
Message 12 of 46
(1,123 Views)
What is confusing? You would enter 02FFFFFF0D. The data without that 0x prefix.
0 Kudos
Message 13 of 46
(1,115 Views)

Hello,

I tried like this but it shows error as shown here 

TimeOut_Expired.JPG

 

Can someone explain what is cause of this error and how to overcome this.

Thanks.

 

0 Kudos
Message 14 of 46
(1,109 Views)

It looks like your protocol uses Carriage Return (0D) as a termination character. The VISA Configure Serial Port VI uses Line Feed (0A) by default.  You need to change the termination character to 0D.

 

Then get rid of Bytes at Port. Set the Byte Count input of Read to a number larger than the longest message you expect to receive. You indicated that the format specifies at least 22 bytes, so make Byte Count = 100.  You can also eliminate the 1 second Wait because the Read will wait as long as needed to get the next termination character.

 

Add a VISA Close after the loop so that the serial port is properly shut down. Otherwise it may not work the next time you try to use it.

 

Lynn

0 Kudos
Message 15 of 46
(1,104 Views)
Change the representation of the data array to U8.
0 Kudos
Message 16 of 46
(1,102 Views)

Thanks for the help.

I made these changes and the transmitter(ucontroller) is responding

1)Changed termination character to 0D in  VISA Configure Serial Port VI.

2)Byte Count = 100 and 3)representation of the data array to U8

 

But I am not sure of

1) How to add VISA Close and

2) Why I am getting the wired read values as attached.Whereas the controller sends data in this format 0x01 0x02 <18 bytes of information data> 0x03 0x0D.

Can I get assistance with the receiving part as well to get the required data such that each time I receive this data (0x01 0x02 <18 bytes of information data> 0x03 0x0D)

3)I want to separate the information data into 6 parts such that each part contains 3bytes

4) converting these 3bytes data into 2's complement

thanks.

 

 

0 Kudos
Message 17 of 46
(1,083 Views)
You were already told how to change a string for hex display. Why the for loop? Read the number of bytes and then use the opposite of byte array to string - string to byte array. You already got an answer for the conversion - http://forums.ni.com/t5/LabVIEW/Post-processing-the-received-serial-data/m-p/2903048

Please stop posting duplicate questions in different threads.
0 Kudos
Message 18 of 46
(1,069 Views)

Have you worked through the on-line tutorials for Getting Started with LabVIEW? Answers to simple things like how to change display style and how to connect a function after a loop should be apparent after learning what those tutorials are trying to teach.

 

Pop up on a string control, indicator, or constant and select Visible Items >> Display Style. That will change the apparance to show which display style is active. About 2/3 down the pop up menu on a string control or constant are 4 choices for display style. You want the last one: Hex Display.

 

Here are images of how the same data looks in the three dispaly styles, one way to separate your data, and Close.

 

Lynn

 

String manipulation.png

 

VISA Close.png

0 Kudos
Message 19 of 46
(1,063 Views)

Hello,

 

There seems to be another thread also interleaved with this one:

http://forums.ni.com/t5/LabVIEW/Error-with-data-sent-with-VISA-communication/m-p/2903834#M841892

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 20 of 46
(1,028 Views)