;This code is written for the SX28 with a date code of AB9921AA (or later) ;and requires the SXKEY28L.exe software for assembly and programming. ; ; ; Device data ; device SX28L,turbo,stackx_optionx,oscxt5 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/pwm.src, 1KB, , updated: 2002/2/21 12:04, local time: 2024/11/8 15:45,
3.15.206.88: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://massmind.org/Techref/scenix/lib/io/osi1/pwm/pwm.src"> scenix lib io osi1 pwm pwm</A> |
Did you find what you needed? |
Welcome to massmind.org! |
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! |
.