ADC trigger with FTM1 module

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC trigger with FTM1 module

600 Views
Florijan
Contributor III

Hello, 
I have the application in which I have to control the proportional valve with PWM signal. I have an analog voltage feedback from this valve about how much current flows through this valve. So my idea is to generate a PWM signal with FTM1 module and measure voltage with ADC. So my question is how can I set up the FTM1 and ADC to make a voltage measurement while PWM signal is on logic "1" not "0". Is this possible to use FTM1 
module to do both at the same time (generating PWM signal and generating a hardware trigger for ADC)? If yes, how? 
Best regard, 
Florijan

Labels (1)
0 Kudos
Reply
1 Reply

392 Views
TomE
Specialist II

What's the PWM rate? If it is slow enough (relative to the CPU execution speed) then have the PWM also trigger and interrupt and read it during the interrupt.

 

If the interrupt isn't at a convenient time, start TWO timers, one for the PWM and the other one for the interrupt. If the PWM is constant frequency they should stay in sync.

 

If the PWM is too fast, then just have the ADC sample all the time, and pick the right ones in software (the maximum, minimum, ones at the end of the on-slope or whatever).

 

Or add peak-hold hardware and just read the peak voltage if the control loop can handle the filter.

 

Tom

 

0 Kudos
Reply