LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

my VISA READ isn't reading

Hi - I have a super simple vi setup where I have a VISA write (I write to a motor to turn forward using 0xC7 ) and I can see the motor turn. Wired next to it, is the VISA read because the controller that I am communicating to is supposed to return the hex code : AA 55 but I get a time-out every time.

What is happening?

In Codevision AVR I can send the hex command in a terminal and I get the AA 55 back, as expected. What could the difference be ? We don't use any termination characters btw.

Thanks!
0 Kudos
Message 1 of 15
(3,767 Views)
You should use the Bytes At Port function prior to reading. Could be that you are reading before the bytes are there. Put Bytes At Port into a while loop and exit only when the number of bytes is greater than zero, then wire the number of bytes to the Read function's Number of Bytes to Read input. If this don't work, send a sample of your code.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 15
(3,762 Views)
i did this but it didn't change a thing. please see attached vi........



@tbob wrote:
You should use the Bytes At Port function prior to reading. Could be that you are reading before the bytes are there. Put Bytes At Port into a while loop and exit only when the number of bytes is greater than zero, then wire the number of bytes to the Read function's Number of Bytes to Read input. If this don't work, send a sample of your code.


0 Kudos
Message 3 of 15
(3,756 Views)
NEVERMIND - my bad, it DID work. Do I have to have it in the while loop though? Thanks!
0 Kudos
Message 4 of 15
(3,755 Views)
See attached vi for the proper solution. While loop is necessary to wait until bytes have arrived.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 15
(3,751 Views)
oops i only have labview 7.0

can you please revert?
0 Kudos
Message 6 of 15
(3,739 Views)
Here it is:
- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 15
(3,735 Views)
it's a beautiful thing...thanks....

but now my return bytes from visa read are just the command that i sent to visa write. for example if i send C7 i should get back AA55 but instead i just get the C7 back.

did we change something because i was reading hex AA55 yesterday?
0 Kudos
Message 8 of 15
(3,724 Views)
I don't see anything in the vi that would cause that. You must actually be getting those characters back from your device. You can use hyperterminal to verify this. If hyperterminal gives you something different, then you need to investigate the vi. However, the vi is simple and straightforward and I can't see anything wrong with it except that you should put a VISA Close at the end (please do this, I forgot to include it). Perhaps the device on the other end needs initialization or something to get it started.
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 15
(3,722 Views)
the only thing is that i don't know how to type in hex code into the hyperterminal or any other type of VISA session like Instrument I/O Assistant express vi. my co-worker did the Codevision AVR stuff. do you know how to specifiy that what i am typing is hex?
thanks!



@tbob wrote:
I don't see anything in the vi that would cause that. You must actually be getting those characters back from your device. You can use hyperterminal to verify this. If hyperterminal gives you something different, then you need to investigate the vi. However, the vi is simple and straightforward and I can't see anything wrong with it except that you should put a VISA Close at the end (please do this, I forgot to include it). Perhaps the device on the other end needs initialization or something to get it started.


0 Kudos
Message 10 of 15
(3,713 Views)