LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

recieving text echo

Solved!
Go to solution
I love this forum the answers are great, accurate, and prompt. Hopefully you guys can answer another one for me. I'm queuing up my oven with various program steps. Embedded in the commands is a "text echo" command so when the oven gets to that point in the queue it echo’s the string “Done!”. I want to wait for this command elsewhere in the code. I tried doing what’s below: (see attached diagram) but it doesn’t seem to be working and really lagging my system down Any advice?  
The 28 byte maximum length of the TE command text begins

immediately after the TE. Internally, the C4 accepts all characters up to the first

terminator (See '7.3.3). When the string is processed, all leading blank characters are

stripped and then one leading space is placed between the TE and string upon return.

Thus, all of the following:

TE123 -45,6<CR><LF> no leading space

TE 123 -45,6<CR><LF> one leading space

TE 123 -45,6<CR><LF> multiple leading spaces

return

 

TE 123 -45,6<CR><LF>

 

 

Message Edited by lebogzy on 04-21-2009 09:56 AM
0 Kudos
Message 1 of 11
(3,914 Views)
You have not shown the rest of the code, but my guess is that you do not have the serial VISA connection configured properly. Is the termination character enable on or off? What are you using for the termination character? Is there any error coming out of the VISA Read? If so, what is it? You said the message you're supposed to receive is "Done!". Based on your message, it seems that you terminate commands with CR/LF. What about messages sent by the instrument. Even if it's CR/LF, "Done!" + CR/LF is 7 characters, not 8. If you do not have the termination character enabled and the termination character set correctly, then the VISA Read will sit there waiting until the timeout (something like 20 seconds).
0 Kudos
Message 2 of 11
(3,901 Views)

Thanks for the quick reply! 

 

How do i know if the termination character enbale is on or off? what does that mean? Visa read just sits there, and times out. its not 20 seconds, but its definately a length of time.

 

When I send commands to the instrument, I always send (for example) "TE Done!\r\n".


Besides changing the 8 characters to 7, what else should i do? 

0 Kudos
Message 3 of 11
(3,893 Views)
0 Kudos
Message 4 of 11
(3,892 Views)

lebogzy wrote:

 

How do i know if the termination character enbale is on or off? what does that mean?


The termination character (if enabled) can used by the VISA Read to know when to stop reading. Thus, if you enable it, and set it to linefeed, then the VISA Read will stop reading once it sees a linefeed character on the serial port, even if you wired a larger value to the byte count input than you. Thus, if you wire a really large number (like 200) to the byte count input, and you've enable linefeed, and the VISA Read sees a linefeed after, say, 18 characters, then that's all that you will get. The VISA Read will not sit there until it fills up with 200 bytes. If the termination character is disabled, then the VISA Read will explicitly wait until it has the same number of bytes that you've wired to the byte count input. If it doesn't get that many by a certain time, it will time out. The timeout value is programmable. 

 

How do you know if the termination character is enabled, and what it's set to? That would be wherever the VISA session is opened and configured. Based on your latest screenshot, this would be in the "Initialize" VI all the way to the left.

 


When I send commands to the instrument, I always send (for example) "TE Done!\r\n".


I have no idea what this means, or whether it's right, as I don't have the documentation for that instrument.

 


Besides changing the 8 characters to 7, what else should i do? 

It depends. The latest screenshot you provided now has a value of 6. Where did you get this code? Is this something you modified?

 

0 Kudos
Message 5 of 11
(3,886 Views)

Attached is the 'initialize' vi. The commands i send to the instrument are correct, syntax wise. I always terminate them with a \r\n and didnt even realise this was something that was externally configured.

 

The problem with the visa read portion is that its only going to recieve the text once, every 45 minutes. Does that mean it will keep timing out for the duration of that time?

 

As for the code, most of it is mine with the exclusion of a subVI's which i downloaded from the application example online.

Thanks for baring with me, i've been using labview for just under a week now 🙂

 

As for the 6 bytes now, i got rid of the exlcamation mark. So now the oven should only send "Done" \r\n

Message Edited by lebogzy on 04-21-2009 10:59 AM
0 Kudos
Message 6 of 11
(3,865 Views)

That does not appear to do any kind of configuration of the serial parameters for a VISA session, so you'll get the default values. By default, termination character is disabled.

 

Since you receive the "Done" message every 45 minutes, and not as a response to a command, it doesn't make sense to have the VISA Read trying to read the message after you send the command. You will need to have a separate loop that monitors the serial port for that message. This loop should use the VISA Bytes at Serial Port to determine if there's anything on the port to read. How it's supposed to be synchronized with whatever you're doing I can't really say because I don't really know what your overall process is doing. 

0 Kudos
Message 7 of 11
(3,850 Views)

gotcha.

 

however i'm usign GPIB. Will visa bytes still work?

0 Kudos
Message 8 of 11
(3,841 Views)
Solution
Accepted by topic author lebogzy

<Sound of head thumping on table>

 

For some reason I thought you were using serial. Forget everything I said about termination characters. You'll still need the part about needing the separate loop if you don't expect a response after each command, but only "every once in a while". 

Message 9 of 11
(3,833 Views)

smercurio_fc wrote:

<Sound of head thumping on table>

 

For some reason I thought you were using serial.


I thought so too.  It was never mentioned until much later in his 5th reply (#8 overall) that it was actually GPIB and not serial.  And the screenshots gave no indication either.

Message Edited by Ravens Fan on 04-21-2009 09:04 PM
0 Kudos
Message 10 of 11
(3,815 Views)