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: 

License Plate

Hello! I made a project of remote gate opening by license plate. When the program recognizes the license plate, the gate opens automatically. For the program to work properly, I want the timing to start automatically and the number of parking spaces to be reduced when the gate is open. I think this is the problem between Event Structure and Case Structure. How can I fix it?

 

Best regards and thank you!

0 Kudos
Message 1 of 7
(2,420 Views)

You need to rethink your overall architecture.  You have numerous parallel loops each doing their own thing.  You are relying on local variables to pass information between them which will probably give you problems with race conditions.

 

Three of your loops have event structures in them, and one of them is in a loop that will never end.

 

You should be able to write your whole program in a single loop with a state diagram architecture.

 

One state is idle waiting for an event.

When a car is detected, decode the license plate and decide what action to take next.

If it is open the gate, then open it and decrement your counter that you store in a shift register.

Close the gate,

Return to your idle state.

0 Kudos
Message 2 of 7
(2,404 Views)

Thank You for your reply!

I know, this is not very good project, becuase I am beginneing user of LabVIEW :/. There is a possiblity to fix this project? The deadline is near and I don't have enough time to do a whole new project 😞

 

Thank You!

0 Kudos
Message 3 of 7
(2,383 Views)

Of course it is possible.  You don't have that much code in it now, and if you plan your state machine properly, as in plan it on paper first, it will not take that much code to implement.  Less than what you have now.

0 Kudos
Message 4 of 7
(2,355 Views)

Here's a simple demo state machine that might be helpful.

I didn't put in any handling for actual recognition, validation, etc. It is entirely controlled by buttons and simple dialogs, but shows the flow of a possible state machine.

The code is saved back to LV2015.


GCentral
0 Kudos
Message 5 of 7
(2,276 Views)

Thank You!

It helped me a lot!

0 Kudos
Message 6 of 7
(2,051 Views)

@tomekszt wrote:

Thank You!

It helped me a lot!


That's great! If your problem is solved, please use the Mark as Solution button to identify the post(s) that solved the problem, so that the thread will be marked as solved.

If it's not solved, don't click that (yet) - feel free to ask more questions about the same problem.

As a shameless note to a new forum member, we also tend to show thanks via the kudos (star button) option 😉


GCentral
0 Kudos
Message 7 of 7
(1,784 Views)