Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with serial device

Solved!
Go to solution

Hey everyone,

 

I'm quite new at labview

 

I hooked up a rs 232 serial device to my computer and installed the drivers for it and all that good stuff. I opened hyperterminal and had no problems communicating with the module.

 

When I opened one of the serial example VIs in labview I tried sending commands and I kept getting an error message saying it had timed out.

 

BUT

 

When I sent the same command 5 or 6 times at once i.e

VM 1 0

VM 1 0

VM 1 0

VM 1 0

VM 1 0

my module recieves the command and functions fine.

 

What did I do wrong???

0 Kudos
Message 1 of 7
(3,808 Views)

What is the exact string you entered into the 'string to write' control? Did you include the CR and LF (\r and \n)?

0 Kudos
Message 2 of 7
(3,807 Views)

I tried it like

VM 1 0

which worked in hyperterminal but labview timed out.

 

I just tried

VM 1 0\r\n

and it still timed out.

 

When I type

VM 1 0

VM 1 0

VM 1 0

VM 1 0

VM 1 0

my module clicks and valve #1 closes like the code told it to but the read string says "VM 1 0VM 1 0 ERROR: WRONG # OF ARGS".

0 Kudos
Message 3 of 7
(3,803 Views)

Perhaps you need to add some inter-character delay like Hyperterminal. Try the options here.

0 Kudos
Message 4 of 7
(3,789 Views)

Thanks for the suggestion but I still couldnt get it to work.

 

Someone else suggested that the reason it times out when I send the command once is because the vi might be expecting a certain amount of bytes. The more I type in the string to write box the quicker it responds but I dont know how to change that.

 

Is that a possibility?

0 Kudos
Message 5 of 7
(3,783 Views)
Solution
Accepted by topic author rjh123

Hi

 

Did you type the \r \n characters in "\' Codes Display" mode ?

right click on the string and select this mode before typing \r \n

 

 

greetings from the Netherlands
Message 6 of 7
(3,780 Views)

THANK YOU!

I switched to codes display and it works perfectly now!

0 Kudos
Message 7 of 7
(3,776 Views)