Dan Michaels says:
"Math-Averse, Stupid Guy's, Hi-Speed 8-Channel PWM"Use a lookup table.
The uC can't do anything else when it's running, and you may get a fairly-long pause every time you change one of the 8 duty cycle values, since you have to reload or recalculate the entire table.
**BUT**
On a 20 Mhz PIC, you could get rock-steady 8-channel PWM at maybe 1-2 usec/step, or 1953-3906 Khz for 256 steps.
Or switching to a 50 Mhz Scenix SX18, you can get rock-steady *7* bit 8-channel PWM at 200 nsec/step, or 39,062 Khz - limited to 7 bits since SX RAM = 128 bytes.
; (send block to port B - 10 clocks/loop = 200 nsec). send_block jmp :L3 ; jump to re-start (initialization). :lp1 nop ; can insert code here for bailout. nop nop :lp2 setb FSR.4 mov w,IND mov rb,w incsz FSR jmp :lp1 ; jmp takes 3 clocks on SX. ; (reload - re-entry takes exactly 10 clocks). :L3 mov w,#bufstart mov FSR,w jmp :lp2[sorry to inject heretical scenix code into the PIC universe].
Better yet, you can easily spread the PWM energy evenly over the period, to minimize external circuitry hassles. Better yet - no need to jump into FPGA technology, if you aren't already there.
Also:
Questions:
file: /Techref/scenix/lib/io/osi1/pwm/rampwm.htm, 2KB, , updated: 2008/2/11 15:34, local time: 2024/11/5 17:20,
3.231.219.178:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.piclist.com/Techref/scenix/lib/io/osi1/pwm/rampwm.htm"> PIC/Scenix RAM Table Pulse Width Modulation</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to www.piclist.com! |
.