Modifying PID controller c code

Applications, development tools, FPGA, C, WEB
Post Reply
jacafry
Posts: 2
Joined: Wed Jul 16, 2014 9:47 pm

Modifying PID controller c code

Post by jacafry » Thu Jul 17, 2014 6:38 pm

Hello,

I have been modifying the controller c code of the PID application to have different gains depending on the input voltage. I have run into problems when I try to read the voltage values within the pid_update function. I appended pid_init, pid_exit, and pid_update to the end of main.c and included the fpga_pid.h header file at the beginning of main.c.

Then I hard coded the pid_update function to give me a proportional gain of 4000 cnt when I do not have the PID checkbox clicked and the average voltage of channel 1 is greater or equal to zero. The code below shows the changes to the pid_update function that I have made.
pid_update.txt
When I tested the code, I sent in a DC voltage to ch1 and slowly increased or decreased the voltage. I found that the output from the Red Pitaya is linear for both positive and negative voltage. I then checked to see if params[MEAS_AVG_CH1].value was equal to zero, but there was no gain for either positive or negative voltage.

I am very new to both c coding and working with pthread mutexes, so hopefully I am missing something simple. Any help would be greatly appreciated. Thanks!
You do not have the required permissions to view the files attached to this post.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 20 guests