LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Small Problem with Simple Labview Code. Please Help :(

Hi everyone!

 

This is my first post. I'm having a small problem with an assignment that I have been given. The objective is to create a (1) continuous random number generator and a random number multiplication generator (a multiple of (1)), using a queue and a event structure w/ while loop. For example, if a rndm # was 60 with a specified multiple of 3, one the indicators would show 60 and the other one would show 180. However, these numbers would be continuously changing. I made a program that has all of these componentes, but it doesn't work continously. The for loop only iterates twice and stops! Can someone please look at this and help me? It will be greatly appreciated.

0 Kudos
Message 1 of 22
(2,833 Views)

See this and let me know is this what you are looking for?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Message 2 of 22
(2,825 Views)

can't see your vi.

but how much information i can get from your post. For an assignment first you should read difference between For Loop and While Loop.

Message 3 of 22
(2,823 Views)

Hi Ranjeet,

 

Unfortunately, the code i'm supposed to use needs to have a queue (w/ obtain queue, enqueue, dequeue ) and an event structure.

0 Kudos
Message 4 of 22
(2,822 Views)

OHHH I'm so sorry! I meant while loop!. I mistyped it in my statement. Sorry and thank you!

0 Kudos
Message 5 of 22
(2,821 Views)
0 Kudos
Message 6 of 22
(2,818 Views)

Hi Zoneator,

 

The "value change" event won't be fired for programmatic front panel updates- in general, events handle actions that occur in the user interface (clicks, user entries, etc.).

 

If you want to trigger a value change event when you update the value from the block diagram, you'll need to use the Value-Signaling property node.

 

That being said, you probably don't want to dequeue the data within the event structure at all- this is typically done in an asynchronous loop.  I'd recommend taking a look at the Producer-Consumer (Events) design pattern. An example of this can be found here:

 

Community Example: Producer-Consumer (Events) with Error Handling

https://decibel.ni.com/content/docs/DOC-30005

 

Regards,

Tom L.
Message 7 of 22
(2,809 Views)

Is this compulsory?

 

This can be done without queue 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Message 8 of 22
(2,792 Views)

Hi Tom,

 

I modified my labview code to use two while loops and deleted event structure. However, the first loop only runs twice (i used highlight execution) instead of continuosly. Please check my code, I added the code and a snap shot.

0 Kudos
Message 9 of 22
(2,791 Views)

Hi Ranjeet, yeah it's compulsory 😞 I can easily do it without que. However, this assignment requires it, making things a bit more difficult.

0 Kudos
Message 10 of 22
(2,789 Views)