Jump to content

Motor control with FPGA design pattern question

Thang Nguyen

Recommended Posts


I am quite familiar with different design pattern on LabVIEW but I am a newbie on FPGA design. I start working on a project for my own hobby using myRIO to control motor speed with PWM and read back encoder. This is the first part of my project and I plan to expand more later. This project will help me to get use to FPGA too. I am trying to learn a good design pattern by follow the template project which is "LabVIEW FPGA control on Compact RIO". In this template project, feedback value and control signal are analog channels and they connect directly with PID module in FPGA in a normal while loop. The configuration are sent from host. In my prototype project, I already built FPGA module to drive PWM and read encoder using single-cycle time loop. I plan to use PID in real time code. If I want to follow the template design, I have to change the way I implement the code for FPGA and Real-Time. So right now, I am not sure what is a good design I should follow. If you have any advice, I will highly appreciate. 


Thank you very much!

Edited by Thang Nguyen
  • Like 1
Link to comment



Why not implement the PID on the FPGA?  There is a pallette within FPGA to help you do this.  This also means you will not have to concern yourself with FIFOs etc going to/from the real time system.


I have implemented PID in LabVIEW FPGA Before fairly easily.  The aproach to take was not having to recompile the FPGA consistently so make all the variables within the loop readable / settable from the RT System.  Plus the FPGA PID loop should run faster meaning (potentially) better control.



Edited by CraigC
Link to comment

In attachment is my FPGA VI. I have 2 motors. With one motor, I have a single cycle time loop to generate a PWM and another single cycle time loop to analyze the encoder. I would like to ask, if I want to add PID in FPGA, should I create a third while loop to connect encoder value with PID and the PWM generator? This is the only way I think it can happens.




Link to comment
  • 3 months later...

Hey, I am also working on something similar. I have a Guidance, Navigation and control algorithm to drive an unmanned vehicle system. I have written the GNC algorithm within the control and simulation loop and trying to run it but I am getting compilation error also when I would implement this on an unmanned ground vehicle I would require to get encoder count and use it as input for the GNC block and the control the motor through the myRIO. For some reason my hardware components are powering up but not showing any change in the LabVIEW programming. Please help me out. 

Thank you 


Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.