From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with troubleshooting program

I will give a short intro to what exactly I am trying to accomplish and explain the rpoblem I am having. I have one code that scans a barcode and based on the barcode read, assigns a value 1-96 and uses bluetooth to send that value to an EV3 brick that is running this code. I have that part running properly it is this next code that I cannot solve. It is supposed to wait until it recieves a value, and then take that value of 1-96 and based on that converts it into 6 numeric values. Each of those 6 values I have assigned to a certain type of marble. From there, a marble sorter will run and compare until it finds a marble that matches the first one I am looking for. From there I want it to do it for the next 5 marbles that are needed until it has found all 6 correct marbles. I know this is very confusing but I will attach the code and if anyone can help if I can answer more questions I would appreciate it. The problem is that it will wait to receieve a numeric from the barcode, but once it does, my code does not continue, atleast not as I think it should. Thank you very much.

0 Kudos
Message 1 of 8
(4,716 Views)

I don't think we are going to be able to help much because we don't have your equipment to be able to run your code.  You'll need to use the troubleshooting tools available to you to figure it out (probes, highlight execution, extra indicators to look at values on wires.)

 

Your code is way too complicated with too much redundant code.

 

1.  It seems like you are repeatedly doing some things, but have created as series of case structures and loops that appear to be identical.  Whenever you have a series of steps and repeating them, this screams for a state machine architecture.

2.  Those deeply nested case structures scare me.  It is difficult ot figure out what is going on.  Perhaps you wired up some constants wrong in there.  There are other methods for working through a series of if then else statements such as In Range and Coerce.

0 Kudos
Message 2 of 8
(4,709 Views)

@RavensFan wrote:

I don't think we are going to be able to help much because we don't have your equipment to be able to run your code.  You'll need to use the troubleshooting tools available to you to figure it out (probes, highlight execution, extra indicators to look at values on wires.)

 

Your code is way too complicated with too much redundant code.

 

1.  It seems like you are repeatedly doing some things, but have created as series of case structures and loops that appear to be identical.  Whenever you have a series of steps and repeating them, this screams for a state machine architecture.

2.  Those deeply nested case structures scare me.  It is difficult ot figure out what is going on.  Perhaps you wired up some constants wrong in there.  There are other methods for working through a series of if then else statements such as In Range and Coerce.


Those particular deeply nested case structures scare the "Block Diagram Clean-up tool" Too!  What I mean by that is.... the "Block Diagram Clean-up tool "  will spin and spin and hang.  

 

There is logic in there that is wrong!  Probably besause "you are repeatedly doing some things, but have created as series of case structures and loops that appear to be identical."


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 8
(4,666 Views)

Thank you both for your response. I understand the trouble with asking for help and am completely aware of faults in my code. I am so unexperienced and have just been thrown into teaching myself this. I am just trying to learn all as I go. So as you see I have those 6 repeated case structures currently that I believe all run simultaneously. I guess my question is how do I force the second one to wait until the first one has completed and so on?

0 Kudos
Message 4 of 8
(4,652 Views)

As it was mentioned -> use state mashine (while loop with shift register and case structure) 

0 Kudos
Message 5 of 8
(4,644 Views)

The case structures aren't occurring simultaneously.  The loops they are in have a wire running through all of them that sets up a dataflow dependency.  The wire shows up as "Void" for me because I don't have your subVI's, but I'm guessing it is some kind of reference or class wire related to your Lego bricks.

 

My guess is that your logic is failing you and a loop is not stopping when you think it should.  But only you can troubleshoot that using probes and indicators, and highlight execution if you need to slow things down.

0 Kudos
Message 6 of 8
(4,613 Views)

Just so everyone knows, yes I understand there are plentiful flaws and I am not an expert, near that, or ever will be with this program. I am extremely new and I rpomise you telling me how bad everything is didnt get it fixed. But, I did resolve my problem by placing each consecutive of those 6 structure into a flat sequence structure and my code works, flawlessly. So yes this might not be the right solution but for anyone else who is like me, looking for an easy way to fix a problem like that, it worked well for me.

Message 7 of 8
(4,578 Views)

Hi Leviheil,

 

Glad you got it working! 

 

I just wanted to add that if you happen to be a student at a university you should have access to self paced online training for LabVIEW. Here are some basic videos that might help http://www.ni.com/academic/students/learn/, and here are all of the online courses we offer. If you'd like to get more info about how to access these courses feel free to call in at the number at the bottom of this page http://sine.ni.com/tacs/app/fp/p/ap/ov/lang/en/pg/1/sn/n5:selfpacedonline/.

 

I know you mentioned you built this very last minute and had to learn everything yourself, but if you find think you'll be doing more LabVIEW work the above training material might help. 

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments
0 Kudos
Message 8 of 8
(4,558 Views)