LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LIFA BASE for Arduino error

Liu9079 wrote:

I got a new problem now. I checked the block diagram, and it is messed up, I can't see part of it, which include arduino INIT and arduino configure. I am using labview 2014 with windows 7, and the program was designed with labview 2013. should I change my labview to 2013 to solve the problem?

Thank you

I don't understand.  What does "messed up" mean?  You can scroll to any part of the block diagram that you want (or use the pan function).  VIs written with LabVIEW 2013 will open and run in LabVIEW 2014 just fine.

Maybe you could post a screenshot of your issue.

0 Kudos
Message 11 of 21
(1,579 Views)

     Thank you for your time and patient first!

     I can't see the arduino INIT and the arduino configure, the code inside the loop are fine, and I can see the arduino close. I tried different way to clean it, but I still can't find INIT. The first picture is a screen shot of part of the  diagram, and the second one is the "normal" part of the block diagram.

bolck diagram screen shot.JPGCapture 2.JPG

0 Kudos
Message 12 of 21
(1,579 Views)

Can you attach the actual file?  I can't really tell what is going on or the context of that first image.  The second images looks normal and appears like you can just scroll to the left.

0 Kudos
Message 13 of 21
(1,579 Views)
Yes, Thank you for your time. I cleaned up the block diagram by myself a little bit, and attached it below called "motor control 5 partially clean" and the one I orginally got is "motor control 5"
Thank you again for your time and patient
Download All
0 Kudos
Message 14 of 21
(1,579 Views)

The block diagram is so large that it would probably require 100 monitors to view it all at once.  This probably means that it has gone way beyond the dimensions that LabVIEW is even capable of keeping track of.

Therefore, the VI isprobably effectively corrupted.  I would highly recommend that you create a new VI and re-write the code.  Avoid copying from the original VI, don't copy any of the structures (while loop, case structures, etc.) but you'll probably be ok copying the some of the functionality in each of the cases of the case structures.

0 Kudos
Message 15 of 21
(1,579 Views)

Thanks for your help!!

So if I rewrite the code to 4 run stepper motors and 4 load cells, should I write the code to use one arduino board to run one stepper motor and one load cell, and have the program run 4 times? where can I change the com port?

Do you suggest me still use arduino UNO board or change to other board like chipkit you mentioned before, and should I stay with LIFA or change to LINX? they don't have steeper motor sub VIs yet.

Sorry for asking too many questions at the same time, I really appreciate your help.

0 Kudos
Message 16 of 21
(1,579 Views)

I think you are confused.  You can't use one Arduino with 4 different ports.  From the previous discussion, it sounds like you can only run one stepper motor per Arduino.  So, if you want to run all four simultaneously, you need 4 Arduinos each with a different COM port.

With 4 Arduinos you would need to have duplicate or modular code to perform your operations on each of the 4 Arduinos (where each of the 4 Arduino's would have their own Init.vi) if you want them all running at the same time.

However, I don't think you have really confirmed how you want to process the 4 apparatuses so it's hard to say what the best method is for programming your application.

You can use a chipKIT if you want like hrh212 suggested but you wouldn't be able to use LIFA.

0 Kudos
Message 17 of 21
(1,579 Views)

Hi Nathan,

     Thank you for your response. Sorry I asked too many questions, I am not native speaker. I get confused easily and I can't express myself very well sometime, so thank you for being patient with me.

     What I am trying to do is to use stepper motor to stretch sample, and measure the force added to the sample. I want to text four samples at the same time, with each sample, the level of stretching is different.

     I wrote a VI myself for using one arduino board to run one stepper motor and one load cell, it works well so far. Then I pluged two arduino to the computer, Set the VISA source of "arduino INIT" to Com 3 for the first VI, I also double click on all the stepper motor subVIs and set com 3 as VISA source.  Then I set Com 4 for the second VI. It didn't work, and it keep telling me error 5002 and 5003.

"Error 5002 occurred at Init.vi.  Unable to establish connection with Arduino."


"Error 5003 occurred at LabVIEW Interface for Arduino.lvlib:Stepper Close.viLabVIEW Interface for Arduino.lvlib:Analog Read Pin.viLabVIEW Interface for Arduino.lvlib:Stepper ToGo.viLabVIEW Interface for Arduino.lvlib:Stepper Write.viLabVIEW Interface for Arduino.lvlib:Stepper Configure.viLabVIEW Interface for Arduino.lvlib:Init.vi.  A timeout occurred while trying to read form the Arduino."

Could you please tell me if I set the com port wrong way? or is there anything I did wrong?

With chipKit, I won't be able to use LIFA, I can only use LINX with chipKit, is that what you mean?

I also attached my VI, Thank you again for your help.

0 Kudos
Message 18 of 21
(1,579 Views)

You can't split the Arduino resource wire (e.g. you can only have one Close.vi for every Init.vi) because it causes race conditions.  If you absolutely need to have LIFA code in parallel, you need to use a semaphore to prevent the race condition.

Changing anything on the front panel of a subVI doesn't affect anything (those changes are not saved with the exception of unwired recommended inputs where you set a different default value).  You can only set the COM port on the input of Init.vi.

You have many other race conditions in your code.  The location of the code on your block diagram does not dictate order of execution.  When using local variables, you are much more likely to create a race condition.  Always wire controls and indicators directly if possible.

Tip:  You should get into the habit of connecting the error terminals of your subVIs, especially subVI's that share a resource (e.g. the Arduino).  Make sure that you set the error tunnels on loops to be shift registers.

Using any type of wait for an extended period of time is not recommended.  You should consider a state machine to manage when you start each run (it also makes it easier to test and debug).  When using a wait, your code gets "stuck" on that wait VI which means you are not able to stop the loop if you need to (which means you would have to abort your code which is not recommended if it's possible to avoid).

Are you sure the second Arduino is being registered by the operating system as COM4?  Is the second VI identical to the one you posted?  Make sure that you test both Arduino's individually while they are both connected.  I would also create a simply LED blink VI to make sure that you can successfully run them both simultaneously.

Regarding the the chipKIT, yes you can use the chipKIT with LINX but I don't know if it supports stepper motors (LINX is still in beta for stepper motors only for Arduino Uno iirc).  Since you have it working with Arduino's and are willing to simply use multiple Arduino's, I would stay with this approach.

0 Kudos
Message 19 of 21
(1,579 Views)

Hi Nathan,

     I am trying to use semaphore in my code, but it wont' let me connect it with INIT or other arduino VIs, any suggestion?

     Thank you.

Capture.JPG

0 Kudos
Message 20 of 21
(1,579 Views)