PWM period counter

Status
Not open for further replies.

profor

Active member
Hello,

the name of thread might be wrong, but i dont know, how to name it better:)

First of all, what i want to do:

i need to feed 4-20mA module extracted from energy manager RMS621 with squarevawe signal. It is a tiny pcb soldered on main pcb which is powered +-12V and galvanicaly isolated from Altera Cyclone chip by optocoupler. By looking at the logic analyser i found out that the Cyclone feeds the module every 1,25ms with squarevawe signal with period of 7 us (might be different, i was using low sample rate on analyser).

By changing number of periods, the current output changes.

Do you have any idea, how to count PWM cycles and if it reaches, let say 200, stop PWM and then start it again when next 1,25 ms cycle should start?


thank You very much for Your help.
Teensy 3.2
 
One way i could do it is to set one PWM to 150000Hz and other to 800Hz and then use AND gate to output the square wave signal while the other PWM output is HIGH.
 
It all depends on what else your doing, you could technically change the PWM every pulse if your not doing anything else at the same time.

Consider taking a look at some of the Timing and Delay functions.

It sounds strange the way they are driving a PWM to Analog device. Normally you would just feed a constant PWM, not pulse for a short time, stop and then start over a little while later. Consider taking a closer look at the device your trying to interface.
 
Status
Not open for further replies.
Back
Top