local pwmfrequency0 = 2 local pwmdutycycle0= 1 local pwmfrequency1= 0.5 local pwmdutycycle1= 55 local rollvalue local divisor = 4 local mbwrite = MB.W local t = 0 outPin = 0 mbwrite(44000,1,0) --disable dio0 pin mbwrite(44900,0,0) --disable clock0 mbwrite(44100,1,0) --pwm index mode mbwrite(44901,0,divisor) --divisor LJ.IntervalConfig(1, 1000) while true do if LJ.CheckInterval(1) then if t <= 5 then rollvalue=(80000000/pwmfrequency0)/divisor mbwrite(44904,1,rollvalue) --pwmrollvalue mbwrite(44300,1,rollvalue*pwmdutycycle0/100) --config A mbwrite(2000,1,1)--DIO1 Output High mbwrite(44000,1,1) --enable dio0 pin mbwrite(44900,0,1) --enable clock0 print("On FIO0 a ", pwmfrequency0, "Hz signal at a ", pwmdutycycle0, "% duty cycle has been generated") t = t+1 print(t) end if t >= 6 then rollvalue = (80000000/pwmfrequency1)/divisor mbwrite(44904,1,rollvalue) --pwmrollvalue mbwrite(44300,1,(rollvalue*pwmdutycycle1)/100) --config A mbwrite(2000,1,0) --DIO1 Output LOW print("On FIO0 a ", pwmfrequency1, "Hz signal at a ", pwmdutycycle1, "% duty cycle has been generated") t = t+1 print(t) end if t >= 17 then t=0 end end end