Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I put in multiple string input commands the serial visa write function using RS232

I have an application in which I am monitoring 28 Digital I/Os through 2 stackable WTIO-M cards.  (manual attached)

 

I have no problem setting up and writing one command to the board with the Visa serial write function using a concatenated string with a carriage return.  However, when I try to add multiple commands to the read function using a concatanated string array, I get an error.  I've tried using multiple input commands at the end of each line including the ASCII end of line command.  

 

Essentially, I need to be able to initialize all ports.  Then do a simple monitoring on 27 of them for a toggle command from the board.  I'm just stuck trying to write multiple commands to the 'visa serial read' function which is my first step.

 

Any guidance would be appreciated.

 

 

0 Kudos
Message 1 of 10
(8,769 Views)

Unfortunately, what you are describing is not clear. You're referring to adding multiple commands to the read function, or writing multiple commands to the VISA Serial Read, which makes no sense. Do you mean write? Are you using separate addresses?

 

You should be aware that the EOL constant in LabVIEW generates the EOL that's specific to the operating system. On Windows this will be CR/LF. The modules you are using expect only a CR. 

0 Kudos
Message 2 of 10
(8,760 Views)

I apologize for the muddled message.  I'm trying to write multiple commands to the string input of the Visa Write Function which is accesing the WTDIO-M card through the serial port. 

 

Currently I can put in one command: such as AHM which works when I concatenate the string input with the labview carriage return constant.

 

However, when I try to add another command line such as ALM using the concatenate function to the Visa Write string input I can't get it to work.  I've tried labview constants for spaces, end of line etc with no luck.

 

Maybe I'm missing a vital step but I just want to write multiple input commands into one visa write function.

 

 

0 Kudos
Message 3 of 10
(8,751 Views)
Have you verified that the module can actually accept multiple commands in one shot like that? I haven't looked through the datasheet in detail, but it may not be able to, especially if echo is on. For instance, have you tried to send it multiple commands using something like HyperTerminal on Windows?
0 Kudos
Message 4 of 10
(8,748 Views)
This may be the problem, if so, then do I have to do a seperate visa write function for every command in a sequence structure or is their a simpler way to go about this?
0 Kudos
Message 5 of 10
(8,745 Views)
If the module cannot accept a string of commands in one shot then, yes, you will need to send them one after the other. I suspect you will need a read in-between to catch the echoed command if that's on - check the datasheet on this. However, you do not need to use a sequence frame to do this - you can use the error clusters to force execution order. You can write a wrapper VI that sends a command and includes the echo read, making your code easier to write as you'd call this VI to send a command rather than the VISA Write.
0 Kudos
Message 6 of 10
(8,732 Views)
not to forget a for loop when you want all channels to be read each time.
greetings from the Netherlands
0 Kudos
Message 7 of 10
(8,708 Views)

Was this question ever resolved? I am also wondering whether the serial write will accept multiple commands. At the moment only one is being read in labview and everything after \n is ignored.

0 Kudos
Message 8 of 10
(7,838 Views)

That is not clear at all. You say the serial write will not accept multiple commands but then you say only one is read by LabVIEW. Are you doing a write or a read? You can put as much as you want in the VISA Write. It is up to the instrument to accept multiple commands. If you are doing a read, then in order to read multi-line returns, you have to have the termination character disabled.

 

0 Kudos
Message 9 of 10
(7,835 Views)

instead of disabling the endcharacter you also can execute more reads. Data is not thrown away but buffered.

So one read until LF

next read until next LF

greetings from the Netherlands
0 Kudos
Message 10 of 10
(7,812 Views)