08-19-2012 08:27 AM
Hi all.
I have been using labview VISA to communicate with an I/O device called a µChameleon.
I need to monitor the state of mutiple pins by sending a VISA write to poll the pin and then use a VISA read to identify the pins state.
The problem I have is when I use multiple VISA Read/Writes. When I run this, a single VISA Read will return the corresponding pin state but all the rest show nothing. The funny thing is when I use highlight execution they will all return the pin state.
The below picture shows the basic premise of what im doing by just copying the basic serial read and write code. For example I send the string "pin 1 state" followed by a carriage return and if it works correctly it should return a VISA Read string saying " pin 1 1" (high) or "pin 1 0" (low).
Can anyone help me witht this. Is it a timing issue with the VISA Reads??.
Solved! Go to Solution.
08-19-2012 09:26 AM
08-19-2012 11:38 AM
Thanks for your reply.
When you say, ask for the number of characters, what do you mean??.
08-19-2012 02:27 PM
08-19-2012 03:09 PM
08-19-2012 04:04 PM
08-19-2012 05:27 PM
Thanks for the feedback guys but I'm still doing something wrong.
The 2 pins in question are connected to 2 reed switch outputs which detect whether a pneumatic gripper is closed or is open.
I have changed the code as seen in the attachement below but it hangs on the first read and then gives the error as per the second attachment. The bit number "8" on both reads is the expected number of bits for both "pin state" questions. Is there any more input you can give in relation to this problem?. Thanks again.
08-20-2012 06:51 AM
Hi Banjo B
Having looked at your code it looks as if on LabVIEW you are asking for writes from pins 1 and 2. In LabVIEW ports are numbered starting at zero. It may be worth changing your code to request writes from ports 0 and 1 rather than 1 and 2, since the timeout error could have been generated when the second VISA Write function tries to access pin 2 and receives no data.
You may find the following Knowledge Base (KB) article useful; in particular section 3, "Common Problems":
Depending on how old the hardware is that you are using , it may also be that you require a Wait function between the VISA Write and VISA Read functions, as older instrumentation may not be quick enough to respond to commands written to the port.
The following KB article may be of use to you:
Timeout Error -1073807339 on VISA Read or Write
From your code, it looks as if you are using a large enough timeout.
I hope this helps but please let me know if you have any further questions.
Kind Regards
08-20-2012 01:05 PM
Attaching an image does not do any good. You are obviously looking for the wrong string if you have something like /n so you are probably sending the incorrect termination character as well. Did you turn on '\' Codes Display for the string controls?
08-20-2012 04:11 PM