This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28335: PID While loop structure (PID implementation)

Part Number: TMS320F28335
Other Parts Discussed in Thread: PMP23069

Hi Community members,

I want you to check the while loop structure code for my PID simulation.

The idea is to make a closed loop system using PID while loop code. (The bock diagram is given below)

I am directly jumped into code. I am using variable Duty_cycle output as my input (not the Continuous analog voltage)  using a closed loop system. Duty_cycle is a continuous pulse signal. Therefore no ADC is required. This duty cycle is converted into voltage from 0-3V (variable A1) (Please see code). Now the reference is set to 1V (suppose). Now pid while loop is implemented to generate the NEW_Duty and is fed into the system in the form of pwm pulse. Remember the startup PWM pulse will off once it starts taking pulse signal through eCapture(eCap function). I want you to recheck the while loop code for my PID implementation again. because for an open loop system when no feedback. I can see the results of  NEW_Duty on oscilloscope in the form of Pulse (having period/Duty cycle). But once i connect it with the system as a feedback. The systems gets halt or shut down and no values are seen on the oscilloscope (Zero signal, no pulse).  What I believe it should work like if any change happens at the load, the PWM signal (means Duty_cycle = PWM_Duty/PWM_Period..see diagram)  will act accordingly and then feedback (pid while loop from DSP) will compensate the error with respect to reference if the loop is closed. Remember the startup PWM pulse will be off once it starts taking pulse signal through eCapture. Here i am just working on Proportion part Kp (no integer (Ki = 0) and derivative (Kd = 0), is considered here at initial setup).

Please find the attached code.

Please suggest accordingly

Thanks

Kind Regards

Arsalan

  • Hello Arsalan

    For guidance to a PID controller, Please open one of our PFC reference design, pmp23069 for example. In this project search DCL_loadDF22asParallelPID. You will find this function in the file DCLF32.h. This function implements PID controller and will be a good starting point for you.

    Thanks

    Amir

  • Hi Amir,

    Thanks for your reply

    The problem has been resolved now using while loop. Thanks for the suggestion. I am closing this thread.

    Regards

    Arsalan