Home > other >  Turn 16 road PWM scheme, every road in 100-4000 hz frequency can be adjusted independently
Turn 16 road PWM scheme, every road in 100-4000 hz frequency can be adjusted independently

Time:01-20

One project, need to use a few road PWM, every road 100-4000 hz real-time change of adjustable frequency, intends to draw a 16-way PWM output board,
Hand has a microchip 16 series microcontroller, the biggest only supports 32 m crystals, 0.125 us instruction cycle, at most, only different frequency PWM hardware support 3 road, want to use the timer interrupt simulation software implementation, but calculated that PWM frequency is too high, simulation,
Internet some plugins PWM generator, NXP PCA9685 support hardware PWM 16 road, but each frequency are the same all the way, per channel frequency cannot independent setting, and the frequency is less than 4000 hz,
Have any good solution or sell chips? Thank you very much!

CodePudding user response:

LZ do PWM output, generally it is good to change the pulse width, change the PWM frequency is what reason?

CodePudding user response:

Actually in the same clock programming PWM under different high and low level width can change the PWM frequency, PWM clock frequency is higher, the PWM programmable the fine granularity, the higher the accuracy,

CodePudding user response:

The
reference 1/f, worldy response:
LZ do PWM output, generally it is good to change the pulse width, change the PWM frequency is what reason?


PWM interface drive motor, motor, through the frequency modulation speed, adjustable duty ratio,

CodePudding user response:

refer to the second floor qq_708907433 response:
, in fact, in the same clock programming PWM under different high and low level width can change the PWM frequency, PWM clock frequency is higher, the PWM programmable the fine granularity, the higher accuracy,


0-4000 hz frequency is adjustable, make it a level 100 change, each level is 40 hz,
100 level, frequency F=4000 hz, period T=250 us, 99 magnitude, frequency F=3960 hz, period T=252.5 us
Time difference between two levels: T99 - T100=2.5 us, that is to say, I want to be 2.5 us timing interrupt, to achieve a level 100 change,
The interrupt program is still need to put a few lines of code, including 16 road PWM count, comparison, assignment, pin high and low level configuration code, etc.,
MCU with 32 m crystals, instruction cycle is 0.125 us, 2.5 us timing interrupt, equivalent to 20 instruction cycle, there are dozens of code in the interrupt, SCM processing not to come over,
  • Related