LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA event Structure

Hi,

 

Iam working on DC motor...... iam using NI 9505....... iam using example code of labview {(Position Control (closed loop)- under compact RIO}......

 

 

every thing is fine............ now i want to add control LEDs which has to control the speed of the motor......every led represents some values......there are 66 leds.... i thought i can use event structure so that when ever an event(boolean led ) occurs that event will suplly the value of posotion setpoint to motor.........

 

i have added event outsde, inside, with, without while loop...evry thing i tried.......but iam not getting......i wan to know where iam doing wrong..... to understand better  i have attached two images front panel and block diagram......

 

please help me out of this problem...........

Download All
0 Kudos
Message 1 of 8
(4,947 Views)

What confuses me is the fact that you use of "position setpoint" as an indicator, while it is a control. OTOH, you are using LEDs as controls, while typically LEDs are indicators. This is not very intuitive. It seems that the only purpose of "position setpoint" is the use of its local variable.

 

It is difficult to understand why you are reading its value via a local variable while the terminal just sits there disconnected. (Typically, you would replace the "read local" with the actual terminal for cleaner code).

 

You are polling inside the big loop anyway, so you might as well simply calculate the setpoint based on the booleans right there and feed it drectly into the node where it is used. No event loop needed! You should also make sure to use the proper representation, orange seems incorrect.

 

Also your use of a case structure inside an event structure is not very reasonable. What is in the FALSE case?

 

You talk about 66 LEDs, but I only see four. How does the LED pattern translate into the speed? Are you trying to use them as a radiobutton substitute? Index into a binary lookup table? For 66 LEDs, you are better off with an array of LEDs, else the code becomes unmanageable.

Message 2 of 8
(4,938 Views)

HI,

 

Here are the Complete Detials.........

 

1> position setpoint is not an indicator........ its a control

2>  for one rotation of motor is 360 degree---- now i want to rotate motor for 360 degree in 66 times...... and i want to indicate the value....... so i divided 360 by 66 which is 5.45......

 3>  Now i calculated the motor ratio........ digitaly to rotate motor, it requires 1230.5 which is position set point..........

          to rotate motor at 0 degree we need position set point at 0

          to rotate motor at 360 degree we need position set point at 1230.5

 

4> i implemented this  logic outside using 4 LEDs and its values is given( please go through 360 degree implement.vi)

 

5> i want to implement the same logic in this positon control (closed loop).vi

 

        but its not taking the event strucutre.......

 

6> i have attached the vi....... there will broken wires since there is no fpga target..........

 

7> i have attached compelte source code for position control project........ here in this project i want to add 66 leds which will control the motor for one rotation with respect               

           above steps

      

 Please let me know if u need any more info on this.......please go through above snap shots for inserting the LED structure....

 

Thank you

 

0 Kudos
Message 3 of 8
(4,932 Views)

Sorry, I have not looked at your other code, but your "360 degree solution" is not useful. You'll end up with 600+ local variables, 67+ event cases and case structures and an additional case structure with 66 cases. We don't have time for that!!! 😄

 

All you need is a small event structure with three events and a total of two local variables.

 

Use a radio button control for the LEDs, so no logic is needed. Attached is a quick draft using four LEDs. You can easily expand it by adding more LEDs. You could even wrap the entire code into an xcontrol that accepts or outputs degrees, hiding all the logic internally.

Message Edited by altenbach on 12-03-2008 06:21 PM
Message 4 of 8
(4,892 Views)

HI,

 

Thank you for the reply.....i came to know that FPGA and Real time does not support Event structure...............

 

All i request you is that can u give me some idea with using event structure to implement.........

 

The main problem here is the event structure..........avoiding the event structure is the big problem.........i am not getting how to implement with out event structure....?????????

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

sunil_v20 wrote:

i am not getting how to implement with out event structure....?????????


Basically you want a control with dual inputs: a "Ring of LEDs" ***OR*** a "Numeric Control".

 

All you need to do is see which one changed (Typically by using a shift register or feedback node to compare current to previous) and then update the "other" one accordingly. If none changed, just read the numeric. 🙂

 

There are many ways to do this, here is one possibility (at the same time it folds the angle to the range 0..360 and coerces it to a multiple of 360/66.

 

As I suggested before, I changed the LEDs to a radio control, significantly simplifying the code. See if this makes sense to you. 🙂

 

Message 6 of 8
(4,856 Views)
Thank you........i have done it...and got results
0 Kudos
Message 7 of 8
(4,825 Views)

@sunil_v20 wrote:

HI,

 

Thank you for the reply.....i came to know that FPGA and Real time does not support Event structure...............

 

 


I know this is an old post. I just want to put this in here for others that might find this post. 

An event structure that handles User Events does work on LabVIEW Real Time. It just does not handle front panel events, because Real Time does not load the front panels.

 

 

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
0 Kudos
Message 8 of 8
(3,957 Views)