LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intermittent Read of Instrument using Library LabVIEW VI's

Problem - I am currently having an ongoing problem where I can only sometimes read (~2/10 attempts) the ID of an instrument. The instrument is an EG&G M0del 279A Digital Coulometer and I connect to it via RS232 Cable. I beleive the instrument is working properly because I can consistently read the ID, VERSION etc from the instrument using a HYPER Terminal session. The ID is immediately returned on the same line with no space after the last command character because the instrument does not use a line terminator or carriage return.

 

Instrument Documentation - The Commands are ASCII Commands with no line terminator so the instrument looks for the end of each command string based on the number and type of ASCII Characters. An invalid character or string is rejected and a ? is sent back by the instrument.

 

Troubleshooting - I tried using the "Basic Serial Write and Read.vi and the drop-in replacement serial-write-and-read-1-byte.vi" but I still can only read the ID intermittently (~2/10 reads). 8/10 reads return a ? or * (Instrument Prompt) which indicates an error based on the instrument documentation. I tried increasing/decreasing the delay of the read as well as the delay between characters but still reads intermittently.

 

Attached are some additional docs to describe the Hyper Terminal Settings used as well as the Data Interface used by the Instrument.

 

Any help in solving this problem would be greatly appreciated !

 

Barry

 

0 Kudos
Message 1 of 15
(4,139 Views)

Hi biernaskieb,

 

The first thing I would check is whether or not your strings have '\' codes display enabled.  This can be checked by right-clicking your control/constant/indicator.

 

Secondly, I would verify that LabVIEW is sending the correct commands with a loopback test.

 

The PDF you attached seems to suggest that if you don't set up handshaking, then only commands will work and you won't be able to get data.  While I don't see what the correct setup should be, you can play with the VISA property node to set that for the instrument.

 

 

0 Kudos
Message 2 of 15
(4,111 Views)

  Hello Kyle,

 

  Thanks for your reply and helpful suggestions !

 

  I had a look at my command strings and I indeed have '\' codes display enabled.

 

  I do beleive that LabVIEW is sending the correct commands because I am also communicating successfully and consistently with another instrument using the other COM Port. The only difference is that I receive a different ID and this instrument accepts carriage returns after the command is typed in. Attached are string snapshots with "\" codes display enabled of both instrument ID returns from within Hyper Terminal. You will see there are spaces and carriage returns embedded in the first (working) instrument and nothing embedded in the second (intermittent) instrument as this one does not accept carriage returns, strings or invalid characters.

 

  As suggested, if I don't set up handshaking, then only commands will work and I won't be able to get data. Can you give me an example how to properly setup the VISA property node for the intermittent read instrument ?

 

  Thanks !

 

  Barry

 

0 Kudos
Message 3 of 15
(4,095 Views)
Either attach the actual VI or the images. Do not place them inside some proprietary file.
0 Kudos
Message 4 of 15
(4,088 Views)

Okay, attached is the actual VI that I am currently working on.

 

Thanks !

 

Barry

 

0 Kudos
Message 5 of 15
(4,081 Views)

biernaskieb wrote:

  Hello Kyle,

 

  Thanks for your reply and helpful suggestions !

 

  I had a look at my command strings and I indeed have '\' codes display enabled.

 

  I do beleive that LabVIEW is sending the correct commands because I am also communicating successfully and consistently with another instrument using the other COM Port. The only difference is that I receive a different ID and this instrument accepts carriage returns after the command is typed in. Attached are string snapshots with "\" codes display enabled of both instrument ID returns from within Hyper Terminal. You will see there are spaces and carriage returns embedded in the first (working) instrument and nothing embedded in the second (intermittent) instrument as this one does not accept carriage returns, strings or invalid characters.

 

  As suggested, if I don't set up handshaking, then only commands will work and I won't be able to get data. Can you give me an example how to properly setup the VISA property node for the intermittent read instrument ?

 

  Thanks !

 

  Barry

 


Taking a look in you code I noticed that you are using the Basic Serialxxx.vi from the examples.  This VI uses a constant F for termination character enableing.  The Advanced Serial example give youa control for termination char and term char enable.  Optionally you can set these through a VISA property node when you initialize the com port


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 15
(4,068 Views)

  Hi Jeff,

 

  I downloaded and tried out the Advanced Serial Option you mentioned but I didn't have much luck. I can see there is much more control over things like termination char and term char enable in the code. I tried different combinations when comparing the working instrument read to the intermittent instrument read with/without char enable and termination char but it still failed same as before. I tried the "ASRL End Out" options as well but no change. I also tried different probes in different locations and highlighted execution but I could not isolate the fault.

  I am unsure what I can try next but I am open to any suggestions at this point ! :>)

 

  Thanks !

 

  Barry

 

0 Kudos
Message 7 of 15
(4,038 Views)
You did not attach the subVI "serial-write-and-read-1-byte". It would seem that this initializes the port each time since you are passing the com settings to it. this is almost always a bad idea. It would be very nice to see what else this subVI is doing and how it is actually reading the results from the instrument since there is no termination character.
0 Kudos
Message 8 of 15
(4,031 Views)

  Hi Dennis,

 

  Attached is the subVI "serial-write-and-read-1-byte" that I downloaded some time ago from the NI WebSite. I have tried comparing results and debugging directly using various subVI's such as this one as well as others.

  What gets me is the fact the proper ID is indeed read back from the instrument but only sometimes (~2/10) reads. Since it is very intermittent, this would indicate to me some sort of timing issue but I have already experimented with this by increasing/decreasing the delay of the reads. Possibly there needs to be another delay injected into the code somewhere ??? The Tech Docs for the instrument that I have uploaded already, indicate the instrument looks for the end of each command string based on the number and type of ASCII Characters, would it be possible to create a custom loop that takes care of this ???

 

  Thanks ! 

 

  Barry

 

0 Kudos
Message 9 of 15
(4,022 Views)
0 Kudos
Message 10 of 15
(4,020 Views)