06-28-2014 01:15 PM - edited 06-28-2014 01:18 PM
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
Can someone help me out in figuring out this issue.
Thanks.
Solved! Go to Solution.
06-28-2014 01:24 PM
You are running a Greedy loop. Give 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.
06-28-2014 02:08 PM
06-28-2014 02:21 PM
@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.
06-28-2014 02:34 PM
Hi,
VISA error is attached here.
06-28-2014 02:36 PM
06-28-2014 03:04 PM - edited 06-28-2014 03:04 PM
I am unable to make the things you suggested,I ended up here.Can I get further assistance with this.
Thanks.
06-28-2014 03:08 PM
06-28-2014 03:21 PM
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.
06-28-2014 07:27 PM
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.