regarding comparision of two signals in MC9S08SH8

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

regarding comparision of two signals in MC9S08SH8

823 Views
ellendula
Contributor I
hello all.
In my application, i have to generate saw tooth waveform and i have to compare sawtooth with the variable DC voltage to generate PWN in real time.
so anyone help me out, how to generate the sawtooth and how to compare with variable DC.
please provide me pseudo code for comparision of sawtooth with variable DC voltage. and anysort of information related to this, please send me the links (like application notes etc)


thanking you
shiva
Labels (1)
0 Kudos
3 Replies

298 Views
bigmac
Specialist III

Hello Shiva,

 

What you are attempting to do using the sawtooth and comparator seems to be to generate a pulse width that is proportional to a DC analog voltage.  Could you not achieve a similar operation by controlling the PWM output from a TPM module, with the pulse width determined by an ADC result?

 

However, if you really need to generate a step-wise approximation to a sawtooth waveform, using digital techniques, you would need a suitable DAC function, which may require an external device.  Unless the sawtooth frequency is extremely low, I don't think that it would be feasible to use a filtered PWM output for the sawtooth because of the heavy analog filtering required, and the distortion this would produce at the flyback point.

 

Regards,

Mac

0 Kudos

298 Views
ellendula
Contributor I
hello ...
thanks for your reply.
but, if i want to implement PI control in my application digitally, then i have to implement the sawtooth waveform inside the chip itself. so according to the output current, reference is going to change.
so i have to generate saw tooth and it has to compare with the varable voltage and must generate the PWM accordingly.
so, even it is difficulty, its k.
but i want to know , how its going to implement digitally. i require the procedure.
please , tell me how can i do digitally.

thanking you
shiva.
0 Kudos

298 Views
peg
Senior Contributor IV

Hello,

 

Running a comparator on an adjustable voltage and the output of a TRIANGLE wave generator is the old school method of producing PWM. It is totally unclear to me why you would be involving this method along with a microcontroller. Perhaps some further details of what you are trying to do would be in order.

0 Kudos