Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic tutorial of sending Ascii commands via RS-232

Hello,

 

I am a beginning LabView user and have only made vi's using different existing drivers found onine.  Now I have a R25DPDTCNRS RS-232 relay and want to send ASCII commands to control it via LabView.  There are no drivers for this device, so I was hoping someone could please explain the basics of ASCII control with LabView or even show me to some kind of tutorial.

 

Thank you very much.

0 Kudos
Message 1 of 13
(16,537 Views)

Look in the LabVIEW example finder for Serial Write Read.  There should be an example showing how to send commands and read from a serial port using VISA.  You simply write your ASCII commands and read any response if any.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 13
(16,534 Views)

The manual is HERE

 

It is a very basic command set.  I have whipped up part of the driver as an example of how to complete your project.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 13
(16,516 Views)

Wouldn't you know,  I left out the constant on Set Both.vi.  Please accept my appologies.Smiley Embarassed

Set Both.png


"Should be" isn't "Is" -Jay
Message 4 of 13
(16,512 Views)
dear
have good time
i have quick read instrument of marposs so i want read mesuring by labview on serial port .
according examples used visa serial and write and read and close but i ca t read data for example in instrument command M? with inter caractor should be read mesure valve what s problem?
0 Kudos
Message 5 of 13
(14,777 Views)

@hoomanky wrote:
i have quick read instrument of marposs so i want read mesuring by labview on serial port .
according examples used visa serial and write and read and close but i ca t read data for example in instrument command M? with inter caractor should be read mesure valve what s problem?

Exactly what instrument?  What is its messaging protocol?  Where is your code?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 13
(14,769 Views)

Hello,

 

Sorry that I am using the older version Labview and cannot open your Vi.

May I trouble you to take a few screen shot on how you write the E3C command? I still cannot make it work.

Here I attach my simple vi as well as the command list for your comment.

I just try to realize a simple function: to read Relay 1 status. But I dont understand how to put "254,4" command in the correct format. And then the Visa Read always time out...

 

Thank you very much. Looking forward to your reply.

Best regards,

Lu

Download All
0 Kudos
Message 7 of 13
(13,130 Views)

You have the infamous Bytes At Port.  DO NOT USE THE BYTES AT PORT!!!!! (I feel I did not emphasize that enough).  The Bytes At Port causes weird race conditions like what you are seeing.  You write the data and then immediate check to see if any bytes have been received without giving your device a chance to respond.  Since it looks like the device should respond with 1 byte (0 or 1), then just tell the VISA Read to read 1 byte.

 

And finally, since this is using what I call a binary format (others say Hex or ASCII code), you need to turn off the Termination Character.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 13
(13,126 Views)

@dinglu wrote:

Hello,

 

Sorry that I am using the older version Labview and cannot open your Vi.

May I trouble you to take a few screen shot on how you write the E3C command? I still cannot make it work.

Here I attach my simple vi as well as the command list for your comment.

I just try to realize a simple function: to read Relay 1 status. But I dont understand how to put "254,4" command in the correct format. And then the Visa Read always time out...

 

Thank you very much. Looking forward to your reply.

Best regards,

Lu


Here is a 8.2.1 project of the E3C driver

All Commands are enumerated and examples are implemented for Get ID, Enable Selected (Init.vi) Set Single Relay, Set Both Relays, and Get relay Status.

 

Those should demo how to complete the driver.

 

Not bad a 4.5 year bump between anyone using that silly relay board.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 13
(13,114 Views)

I will contact you labview and arduino using proteus, displaying the sensor values underneath and i need help or an example

0 Kudos
Message 10 of 13
(13,087 Views)

@sou1994sou wrote:

I will contact you labview and arduino using proteus, displaying the sensor values underneath and i need help or an example


I recommend you start a new thread and give a lot more information on what you have and where you are stuck.  There are plenty of examples floating around.  But to help, we need to know protocols and any code to show where you are stuck.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 13
(1,330 Views)

Hi,

Thank you very much. I manage to control the shutter finally. Indeed need to convert data using bytes-to-string. However, my shutter still doesn't reply me anything. The read buffer is just empty.

Best,

Lu

0 Kudos
Message 12 of 13
(1,318 Views)

Hi,

Thank you very much. I manage to control the shutter finally. Indeed need to convert data using bytes-to-string. However, my shutter still doesn't reply me anything. The read buffer is just empty. I decided to ignore it.

Best,

Lu

0 Kudos
Message 13 of 13
(1,318 Views)