10-27-2013 11:22 PM - edited 10-27-2013 11:40 PM
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.
10-27-2013 11:37 PM
See this and let me know is this what you are looking for?
10-27-2013 11:38 PM
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.
10-27-2013 11:39 PM
Hi Ranjeet,
Unfortunately, the code i'm supposed to use needs to have a queue (w/ obtain queue, enqueue, dequeue ) and an event structure.
10-27-2013 11:40 PM
OHHH I'm so sorry! I meant while loop!. I mistyped it in my statement. Sorry and thank you!
10-27-2013 11:44 PM
I added a screen shot
10-27-2013 11:50 PM - edited 10-27-2013 11:53 PM
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,
10-28-2013 12:09 AM
Is this compulsory?
This can be done without queue
10-28-2013 12:13 AM
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.
10-28-2013 12:14 AM
Hi Ranjeet, yeah it's compulsory 😞 I can easily do it without que. However, this assignment requires it, making things a bit more difficult.