LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

visa error + relay control.

Hello Everyone, 

 

I am new to LabVIEW so I will try to explain my problem to the best of my ability but please forgive me if my language isn't very concise! Basically, I am trying to get LabVIEW to control a set of relays (numato) that will then control a set of stepper motors. In order for the motors to work, a relay that controls a "motor pair" must open and then a relay that controls the direction of the motor must open. Both should close when the command for a new direction is sent. Currently I have a simple model of how that might work using two motor pairs and two direction relays as examples. I mainly used the example given by numato and then modified it to turn on two relays at once. I currently have it set up to turn on Motor Pair 1(relay 0) AND relay 4 (some direction) at once OR motor pair 2 (relay 1) and relay 6(some other direction) together. 

 

My problem is that when I plug the relays into the computer and run the program I get an error saying that the timeout expired before the operation completed. I don't know what this means or how to fix it. Can someone help? Also, if you have any advice on how I can control the relays in a simpler way that would be great! 

 

I have attached my example code as well an image of the error. 

error.png

 Thanks!

0 Kudos
Message 1 of 3
(1,389 Views)

This makes me think that the Numato examples are really awful...

This is a timeout error saying that the program could not read the specified number of characters within the timeout (which is by default 10 s).

Are you expecting an answer string from the device? Is that answer terminated by a Carriage Return (the \r you see in the string constants)?

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 3
(1,359 Views)

I understand that you're new to LabVIEW so please understand this as constructive criticism.

 

You really need to spend time going through some training materials and examples.  I'm not sure I can find a single element on your block diagram that's good as-is.  I don't have time to tutor you through all of it, here are just a few things:

- not wiring most error in/outs

- multiple event structures outside of loops with infinite timeouts

- latching booleans that are not read inside their "value change" event cases

- reliance on "bytes at port" rather than a terminal character (Note: see below)

- right-to-left wiring when concatenating a carriage return to your commands

- overall lack of coherent programming structure

 

RE: the Numato USB relay boards.  We've tried them out and plan to keep using them, but their communication protocol isn't the greatest.  Much as I've found with many other low-cost serial devices, the docs meander about somewhere between incomplete, wrong and unclear about some of the details.  And it's surely possible that some of what we've discovered below might change with newer builds and firmware on the boards.

- commands to the board *do* need a carriage return at the end

- responses do *not* actually terminate with a carriage return (CR).  They terminate with a 3 character sequence line feed (LF), carriage return (CR), ">".  For the sake of VISA settings, I define ">" as my single termination character for reads.

- the device always echoes back the command you sent followed by LF-CR.  If the command was not a query for data, a ">" will follow the LF-CR.  Otherwise, the query result will follow the first LF-CR, and another LF-CR-">" will follow the result.   These are things you need to know for parsing those results correctly.

- the device does not indicate success or failure when you set relay states.  My habit is to follow up with an explicit query command so I can confirm the success of what I attempted

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 3
(1,343 Views)