LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with data sent with VISA communication

Solved!
Go to solution

 Hello,

I am trying communicate with a microcontroller that needs this data 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0xFF 0x0D to start transmitting data back.

So, I thought to check the data to be transmitted to the microcontroller in Labview by doing a Loop back (by shorting 2 and 3 pins of serial port).

I am sending the 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0xFF 0x0D but the VISA read value is 0xFF 0x0D 0x01 0x2A 0xFF 0xFF 0xFF 0xFF  different from that I sent data which is making me unable to communicate with the microcontroller.

As shown here

                Write_Read_Error.JPG

Can someone help me out in figuring out this issue.

Thanks.

0 Kudos
Message 1 of 46
(3,368 Views)

You are running a Greedy loopGive some delay between the transfer and recieve and try to clear the buffer before you start reading. It looks like you are reading some part of old data from buffer.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 46
(3,353 Views)
You don't think that prepending a 0x means that you are actually sending hex, do you?
0 Kudos
Message 3 of 46
(3,341 Views)

@Dennis:I think you are right because receiver(Microcontroller) is not responding(VISA is showing some error as attached) which should actually if it receives this data 0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0xFF 0x0D.

 

My receiver needs this value for it to start sending the values.

Can suggest me the correct method to send this data  0x01 0x2A 0xFF 0xFF 0xFF 0xFF 0xFF 0x0D from Labview over serial communication to the receiver.

Thanks.

 

0 Kudos
Message 4 of 46
(3,330 Views)

Hi,

VISA error is attached here.

0 Kudos
Message 5 of 46
(3,320 Views)
There are several simple methods. You should have seen the right click menu for a string control/constant where you can select hex display. You can create a U8 array and use the Byte Array to String function.

There have been numerous threads on VISA and hex format. Please do a search.
0 Kudos
Message 6 of 46
(3,317 Views)

I am unable to make the things you suggested,I ended up here.Can I get further assistance with this.

Thanks.

0 Kudos
Message 7 of 46
(3,308 Views)
Can you attach an image? I'm posting from my phone.
0 Kudos
Message 8 of 46
(3,302 Views)

Now you are just showing the hex values for the ascii characters of 0 x  F and F you were showing before.

 

Make your constant display hex like you have now.  Delete everything in it.  Then type in the hex characters that you want to send.  Just FF.  Don't type the 0x becuase that is just a notation used in books to indicate the following characters represent hexadecimal numbers rather than decimal, binary, or octal numbers.  Then wire that directly to the VISA write.

0 Kudos
Message 9 of 46
(3,297 Views)

What is the data coming back supposed to look like?  Does it use a termination character?

 

Your use of the Bytes At Port is likely to cause issues.  If your device uses a termination character (usually a line feed), then you should just set the bytes to read to something really large and let the termination character stop the read.  If not, then you need to wait for the data to come in before checking to see how many bytes are available to read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 46
(3,273 Views)