Jump to content

Using Visa/MAX and sending commands problem


liuman

Recommended Posts

Hi all,

I'm using labview 8.5 and using MAX in an attempt to communicate with a Hamilton MVP electronic valve through a serial/RS-232 port. I know my commands are correct because we have another program built in visual basic (that I didn't work on) and it controls the device fine. I'm just trying to integrate the control into Labview. The com1 port I've chosen is correct.

The commands are something like 1a<CR> or aLXR<CR> where the "a" is the address, and the "LXR" is the command. But even though the commands that I'm using in labview are identical to the ones used in the visual basic program, the device doesn't respond at all. When I read the buffer, the it just echoes what I sent back at me without any error codes or anything.

Anyone know if the viWrite function is able to write the commands that I need properly? Also, when I tick asynchronous write, it gives me an error, to the best of my knowledge shouldn't it be async?

Any help would be appreciated.

Link to post

QUOTE (liuman @ Sep 19 2008, 08:25 AM)

Hi all,

I'm using labview 8.5 and using MAX in an attempt to communicate with a Hamilton MVP electronic valve through a serial/RS-232 port. I know my commands are correct because we have another program built in visual basic (that I didn't work on) and it controls the device fine. I'm just trying to integrate the control into Labview. The com1 port I've chosen is correct.

The commands are something like 1a<CR> or aLXR<CR> where the "a" is the address, and the "LXR" is the command. But even though the commands that I'm using in labview are identical to the ones used in the visual basic program, the device doesn't respond at all. When I read the buffer, the it just echoes what I sent back at me without any error codes or anything.

Anyone know if the viWrite function is able to write the commands that I need properly? Also, when I tick asynchronous write, it gives me an error, to the best of my knowledge shouldn't it be async?

Any help would be appreciated.

I would check all the serial settings baud rate, stop bits etc. Next I would check the EOL character. Does the instrument require a Carriage Return or such at the end of the command string?

Does it work with Hyper-terminal?

N.

Link to post

QUOTE (liuman @ Sep 19 2008, 11:25 AM)

Hi all,

I'm using labview 8.5 and using MAX in an attempt to communicate with a Hamilton MVP electronic valve through a serial/RS-232 port. I know my commands are correct because we have another program built in visual basic (that I didn't work on) and it controls the device fine. I'm just trying to integrate the control into Labview. The com1 port I've chosen is correct.

The commands are something like 1a<CR> or aLXR<CR> where the "a" is the address, and the "LXR" is the command. But even though the commands that I'm using in labview are identical to the ones used in the visual basic program, the device doesn't respond at all. When I read the buffer, the it just echoes what I sent back at me without any error codes or anything.

Anyone know if the viWrite function is able to write the commands that I need properly? Also, when I tick asynchronous write, it gives me an error, to the best of my knowledge shouldn't it be async?

Any help would be appreciated.

Hello there.

One way to be sure that you are sending the right information on serial port is to use a serial sniffer. You can easily find one by googling "Free serial sniffer". There are 2 reasons why your instrument is not responding to the commands you are sending:

1- You did not correctly set your serial settings (baud rate, data bits, parity, stop bit, termination character,...)

2- You are not sending a valid command.

Either points can be validated by using the VB software and a serial sniffer to see the correct command to send and the connection configuration parameters.

Hope this helps.

Yvan

Link to post

QUOTE (liuman @ Sep 19 2008, 08:25 AM)

When I read the buffer, the it just echoes what I sent back at me without any error codes or anything.

You might need to read the buffer twice after each command. Many instruments echo the command you sent on the first line, then send a response on the next line. If you have your serial port setup to recognize end-of-line characters you'll only get one line per read.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.