slow pwm software with multitasking

dvarrel

New Member
Hello,

i manage to code pwm with several outputs, using multitasking capabilities of picaxe18M2

but i can't reach the good output signal. It seems too slow

here is my code below

thanks

LinAxepad, xubuntu12.10

Code:
start0:
output C.0
output C.1
output C.2
symbol sortie1 = C.0
symbol sortie2 = C.1
symbol sortie3 = C.2

symbol periode = b0
symbol mli1  = b1
symbol mli2  = b2
symbol mli3  = b2
; variable mli  0-100 ( % )
let periode = 0
let mli1 = 50
let mli2 = 20
let mli3 = 70

loop0:
wait 2
debug
goto loop0

start1:
pauseus 12
inc periode ; periode 32*4*100 = 12800µs     F=78Hz
if mli1 > periode then
	high sortie1
else
	low sortie1
endif
if mli2 > periode then
	high sortie2
else
	low sortie2
endif
if mli3 > periode then
	high sortie3
else
	low sortie3
endif
if periode > 99 then
	let periode = 0
endif
goto start1
 
Top