LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Through LINX Turning LED on Arduino Off and On a controlled number of Times Error

Hello everyone,

            I am using LabVIEW2023 through the LINX library to control an Arduino Uno. I tested the connection using the LINX example programs "Blink (Simple).vi" and "Blink (Advanced).vi" and they work just fine. I tried to modify the programs so that the LED would blink a user-controllable amount of times. When I tried to run my program, it gives an Error - 54 and a description "Error 54 occurred at TCP Open Connection in LMH-LINX.lvlib:Device.lvlib:TCP Open.vi->LMH-LINX.lvlib:Device.lvlib:Initialize Device.vi->LMH-LINX.lvlib:Initialize.vi->LMH-LINX.lvlib:Open Serial.vi->PrototypeOfControlledLEDBlink.vi", I have linked an image below of the error cluster details.

        If I click continue, the program continues to run and starts to blink the LED but it is always blinked an incorrect amount. For example, I input blink 5 times and it'll blink 3 times, input 6 blinks 3, and input 10 blinks 5. For the most part, I am more worried about the error I get when starting the program as this vi will eventually be a subvi for a more complex project. 

        From my understanding, I am not using the TCP/IP option of the LINX openserial sub vi, yet it still says the TCP address is not configured correctly. For the most part, all I did to modify the example program was to change the while loop from only ending on an "end" button push to ending either when the "end" button is clicked or the while loop has repeated the user-defined amount of times. I didn't touch the serial port LINX sub vi's yet the LINX openserial sub vi now gives me issues. I tested the example programs again to see if they still worked and they did. I couldn't find any information about an Error - 54 on the LINX forums nor online while relating to using LINX.

       I've shared an image of the error popup, my edited program, and the two LINX examples that I used to test. I used the Blink (Advanced).vi to build upon.

Thank you for your time and patience. 

0 Kudos
Message 1 of 10
(1,718 Views)

Your description of the "Blink count" error suggests you and your program disagree on the definition of a "Blink".  (I'm guessing, here).  You seem to define a Blink as the sequence "LED On, LED Off" (or, possibly, "LED Off, LED On"), while your LabVIEW Program defines "Blink" as the sum of "LED On" and "LED Off".  If this is, in fact, the case, the solution is simple -- change your LabVIEW code to count what you consider a Blink (I'd recommend defining a Blink as "turning the LED from On to Off").

 

Bob Schor

Message 2 of 10
(1,664 Views)

Would you save your code as previous version? 

For error 54, make sure the serial port is not blank or N/A.

0 Kudos
Message 3 of 10
(1,644 Views)

Thanks for the response, I've now understood that the issue of the LED blinking an incorrect amount of times is due to the number of actions required to blink it. Rather than my mistake of considering each while loop as a complete blink. I should've added a debug counter to the loop to check how many times it looped and compare that visually to the LED. 

0 Kudos
Message 4 of 10
(1,616 Views)

@GRCK5000

Thank you for responding, I'm not sure what you mean by saving the code as a previous version and I've stepped through the code to the serial subVI to make sure the serial port selection was not empty or N/A. The user serial input selector does correctly detect that the device is available and you can select it as your choice. But, when running the code it throws the error 54. Which from my understanding of Error 54 has nothing to do with me using serial.

0 Kudos
Message 5 of 10
(1,615 Views)

Hi,

How are you?

I'm assuming you are using LabVIEW 2023. Some of us don't have 2023. So if you save for previous version as shown below, it will allow us to open your code. Otherwise, we won't be able to open your code. 

GRCK5000_0-1684117090362.png

GRCK5000_1-1684117123955.png

 

 

 

0 Kudos
Message 6 of 10
(1,594 Views)

Hello,

Here is my program as a Labview 19 version and another as Labview version 21.

0 Kudos
Message 7 of 10
(1,553 Views)

Hi Apple,

 


@TheAppleWhoFell wrote:

Here is my program as a Labview 19 version and another as Labview version 21.


Well, it would help to name the files so we can differ the version before downloading the VI…

 

Your VI after some cleanup:

 

  • Why do you think it's a good idea to hide another loop behind the first While loop? Have you ever considered to use the AutoCleanup button?
  • Why do you think it's a good idea to duplicate frontpanel elements and place them on top of each other?
  • Why do you think it's a good idea to use a while loop when you know the number of iterations before starting the loop? That's a clear definition to use a FOR loop…
  • Why do you need to build your own loop counter using a feedback node/shift register when you could use the loop iterator? (Do you want to blink more than 2^31 times?)
  • Why do you place the error cluster in a shift register, but not the reference/cluster of the LINX functions?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(1,548 Views)

Hello GerdW,

      Thank you for taking the time to check my program. I am as confused as you are about why there is a second while loop, especially because it is hidden behind another while loop. Once I get the chance I'll clean up my program and remove that second loop. Did you find the while loop underneath by moving the above while loop or did you use a different method?

Again, thank you for your time,

Apple

0 Kudos
Message 9 of 10
(1,520 Views)

Hi Apple,

 


@TheAppleWhoFell wrote:

Did you find the while loop underneath by moving the above while loop or did you use a different method?


I mentioned the AutoCleanup tool previously, did I?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(1,500 Views)