LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS485 LabVIEW interface not working with a constant

I need to control an RS 485 interface (not a National Instruments device).

 

I found a vi written by a colleague which I have attached.

 

This works perfectly, so I used a probe to identify the value being generated, and used this to replace the variables with a constant.

 

Now the vi doesn’t work. It runs, but the device it is connected to no longer activates. Then I found that by replacing only one variable with the constant, and keeping the other as a variable kept the vi working.

 

Can anyone offer any suggestions please ?

 

Of course, where I really want to get to is a vi that just reads and writes to a non-NI RS485 interface.

 

Many thanks.

0 Kudos
Message 1 of 7
(5,192 Views)
What constant/variable are you talking about? The string created by the Build Text? You didn't view that with \ codes enabled probably and didn't see the \n terminator.
Message 2 of 7
(5,186 Views)

Hi Placebo,

 

To clarify - in your new test VI, you replaced the two random number generators (that usually generate a number between zero and 60) with two constants in the block diagram - correct?  Did you preplace the number generation or the string being written to the interface?

 

Based on the front panel, it appears that you're setting a position of some sort- is it possible that the device requires a new, unique value each iteration?  Could you describe what happens when the instrument works/doesn't work?

 

As an aside, the manufacturer of the serial interface doesn't matter- any vendor's hardware should be fine as long as you know the serial commands required.  For examples of RS485 communication, refer to the LabVIEW shipping examples (Help>>Find Examples..>>search term "485")

 

Regards,

 

 

Tom L.
0 Kudos
Message 3 of 7
(5,184 Views)

Inexperience strikes again. Yes, you are right, I should have included a \n, thank you.

0 Kudos
Message 4 of 7
(5,142 Views)

Using NI Measurement and Automation Explorer, I sent vset50\n and the instrument responded correctly by going to position 50.

 

Using the 485 example http://zone.ni.com/devzone/cda/epd/p/id/2674      202314.vi    The documentation states that this example will only work with National Instruments RS-485 interfaces. I don’t have and NI 485 and not sure what difference it will make.

 

In 202314.vi    I enabled the termination character  since  RS485_usb.vi ‏55 KB uses this and it works. Not sure what to do about Assert DTR and transceiver mode so I tried all combinations but kept getting error code 1073807330.

 

I looked at (Help>>Find Examples..>>search term "485"), but couldn’t pick anything out that I could apply here.

Yes, the randome numbers are now string constants in the block diagram. The string constant, now including \n, is placed at the VISA write input.

I’ve used Measurement and Automation Explorer to send the same command repetitively and there is no problem with this, the instrument jiggles back and forth and rests at the original position.

When the instrument doesn’t work, the vi completes without errors, but there is no instrument activity.

Any thoughts would be appreciated.

0 Kudos
Message 5 of 7
(5,134 Views)
It is just silly to run an example for an NI device when you don't have that device.

If the command works in MAX but not in LabVIEW, there is something wrong in your LabVIEW code. You did not attach it so I have no idea what the problem is now.
0 Kudos
Message 6 of 7
(5,133 Views)

Hi Placebo,

 

The example you linked specifies NI 485 interfaces because it configures hardware options that are probably not supported on your hardware or need to be set in a different manner.  This configuration happens before any serial commands are written, so if an error is returned then nothing will be sent to the instrument.

 

A quick ni.com or Google search on "error 1073807330" indicates that the error message pop-up window probably reads "The specified state of the attribute is not valid, or is not supported as defined by the resource."  and is almost certainly related to the invalid configuration step.

 

KnowledgeBase 368CM31P: VISA Configure Serial Port Yields Error -1073807330

http://digital.ni.com/public.nsf/allkb/837E900144390C8C86256E35006C6A2D

 

 

The "Basic Serial Write and Read" example found in the Example finder after searching for "485" is equivalent to the example you linked minus the additional hardware configuration step and is probably what you need.

 

Thanks for linking your VI in the last post; posting screen captures of any errors you see as well as the error message displayed is always a good idea on the forums!

 

Regards,

Tom L.
0 Kudos
Message 7 of 7
(5,107 Views)