r/LabVIEW • • Oct 27 '25

Need help creating a LabVIEW FPGA project to control a servo

Hey everyone, been at this for 5 hours, want to cry, takes forever to compile, I'm using the pins from the project essentials guide in the image I'll I'm gonna post, please help

I’m working on a LabVIEW FPGA assignment and could use some help. The task is to: Taken from my profs instructions:

Create a new project named LE03HW02_Servo

Set up the necessary infrastructure to program the FPGA (like we did in the lecture)

Write a VI called Servo_FPGA.vi with a Dial Control on the front panel to control the servo angle

The program should use a simple two-state state machine that includes programmable waits and sets the digital output (True/False) to control the servo signal

The reason the wait is outside was I was trying to see if anything would happen

Please of great LabVIEW redditors assist this lowly Uni student in his time of need

6 Upvotes

11 comments sorted by

3

u/wasthatitthen Oct 27 '25

Are you familiar with the PWM signal a servo gets? 50Hz (20ms) and 1-2ms pulse width for min to max angle.

After that you can have the wait time in a shift register that alternates between a value = 1 and 2ms for on and (20-value)ms for Off in the respective cases.

Because you’re fixing the wait time in each case you’re basically going to jump between true and false in successive loops. I’ll let you think about how to do that.

There are other ways to do it without using a wait function.

3

u/Flaky_Type8674 Oct 27 '25

Other ways without a wait?, I think my problem is I don't have enough background knowledge to know what to search for, any hints? And I'm not too familiar with the PWM too

3

u/wasthatitthen Oct 27 '25

Basically keep checking the time vs a start time while doing something and when you reach a desired time interval you change the condition and reset the start time to the current time and continue with the next process.

Waits are ok, but they can mean you can’t do anything else, because you’re waiting.

1

u/Flaky_Type8674 Oct 28 '25

I think I'm gonna have ask you dumb it down and break this program into pieces for me, I'm struggling to visualize what's happening and how it works😅

1

u/Flaky_Type8674 Oct 28 '25 edited Oct 28 '25

https://imgur.com/a/KNaxmgI Managed to come up with this,my prof says I need to use a wait like that, I've got a case structure for true and false, what values would recommend I do for the waits?

The plan is too use 500 micro seconds in the false and 2500 in the true Does this work?, and if so why

→ More replies (3)

1

u/wasthatitthen Oct 28 '25

No worries… it can be hard to make sense of if it’s new.

1

u/Flaky_Type8674 Oct 31 '25

Hey. Late reply I know, Managed to get it done, thanks so much, and thanks to everyone on the sub🙏

2

u/SeasDiver Champion Oct 27 '25

May be an image artifact. But it looks like front panel Boolean wires into while loop tunnel and to case structure over the shift register without being connected to the shift register. If that is the case, you will always execute one case and never be able to switch to the other case.

Also, I would expect the case to have a not in it so that we would switch back and forth between the cases.