Integrator control on ATxmega128A1

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear users,

I want to implement an Integrator Control on my ATxmega128A1.
The physical system under control is a low pass filter simulated by a labview VI on a PCI - 6052E National Instrument board.
The output from the physical system is my error signal and is sampled by my MCU, processed (by means of an integrator control) and converted to an analog control signal that is fed into the LOW pass filter input.
The control system output is normalized so that the 16-bit resolution of the uint16_t controller parameters can match the 12-it resolution of the DAC.
Unfortunately, the control doesn't work:
- The noise (digitally added at the input and the ouput of the NI board) is not filtered;
- The offset of the signal error is followed neither by the error nor the control signal;
- Whenever I query the controller through the USART, the control and error signal abruptly change their values, sweeping the whole range.

What is wrong with the code or what is the reason for such a misbehavior?

I'm attaching a copy of the code I use to program my MCU.

If any more information is needed, please let me know.

Sincerely,
Nicolò Antonietti

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How are you monitoring the signals? Is it the values you're reading through the UART that are messed up or what you're reading through scope?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also, I see you are saving x and y by this.

   x1 = x;
   y1 = y;

But why? There are no other operations on these variables so why save them? Should they be assigned somewhere else?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm monitoring both the control and error signals by: scope, UART and labview software. They're all in agreement but the values don't seem to behave according to what is expected by an integrator:
- error is similar to control and constant as though there was no control;
- when the MCU is queried both values shift as if they were random.

The Integrator filter has memory; I save x1 and y1 meaning x[n-1] and y[n-1] as they'll be used in the next loop iteration.
The filter equation is y[n]=G((x[n]-offset)+(x[n-1]-offset))+y[n-1].

Thanks for replying.