;pwm.src ; ; Device data ; device pins28,pages4,banks8 device turbo,optionx,oschs reset start ;set reset jump address ; ; ; Variables ; org $08 temp ds 1 ;temporary workspace org $10 acc0 ds 1 ;pwm accumulators acc1 ds 1 acc2 ds 1 acc3 ds 1 acc4 ds 1 acc5 ds 1 acc6 ds 1 acc7 ds 1 duty0 ds 1 ;pwm duty cycles duty1 ds 1 duty2 ds 1 duty3 ds 1 duty4 ds 1 duty5 ds 1 duty6 ds 1 duty7 ds 1 ; ; ; Interrupt routine ; update eight 8-bit pwm's on rb pins at 1MHz ; total service time is 32 clocks ; at 50MHz, 18 MIPS are left over for main app ; org 0 ;3 ;interrupt entry add acc0,duty0 ;2 ;update pwm0 rl temp ;1 add acc1,duty1 ;2 ;update pwm1 rl temp ;1 add acc2,duty2 ;2 ;update pwm2 rl temp ;1 add acc3,duty3 ;2 ;update pwm3 rl temp ;1 add acc4,duty4 ;2 ;update pwm4 rl temp ;1 add acc5,duty5 ;2 ;update pwm5 rl temp ;1 add acc6,duty6 ;2 ;update pwm6 rl temp ;1 add acc7,duty7 ;2 ;update pwm7 mov w,<<temp ;1 mov rb,w ;1! ;output pwm states mov w,#-50 ;1 ;repeat every 1us retiw ;3 /32 ;interrupt exit ; ; ; Main program ; start mov !rb,#%00000000 ;make rb outputs mov !option,#%10011111 ;enable rtcc interrupt :loop ;(update duty0-duty7) jmp :loop
file: /Techref/scenix/lib/io/osi1/pwm/Pwms.src, 1KB, , updated: 2002/3/12 21:21, local time: 2024/11/9 17:27,
3.145.64.152: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://sxlist.com/techref/scenix/lib/io/osi1/pwm/Pwms.src"> scenix lib io osi1 pwm Pwms</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.