pwm for led

lamxe

Senior Member
Dear All..
I would like to build 3 different pulse generator for to try driver led in the time fountain device with 08m picaxe ( if cannot I will to buy 08m2)
Please could you help me by give me this code . I've tried writing this code but only out( 0) work .Many thank you in advance.
Code:
       ///////////////////////////////////////////
  08m or 08m2  picaxe 8mhz
 Do :
high 0  pause  1.8 ms  low 0   pause  14.86 ms  loop
high  1  pause  1.5 ms  low  1  pause  15.16 ms  loop   
high  2  pause  1 ms    low 2   pause   15.66 ms  loop
              ///////////////////////////////////////////////////
'Here exact my code
#picaxe 08m2
#no_data
setfreq m16
Do
high 0 pauseus 180 low 0 pauseus 1486 loop
high 1 pauseus 150 low 1 pauseus 1516 loop
high 2 pauseus 1 00 low 2 pauseus 1566 loop
 
Last edited:

hippy

Technical Support
Staff member
It may help to post the exact code you are trying, but I would guess that the program is stuck in the first DO-LOOP which only pulses output 0, and will never go beyond that.

Given the time periods involved it is not immediately easy to see any way to do all the timing together using bit-banging even if using an 08M2. The loop frequencies would probably also be too low to use PWMOUT. Probably the best solution would be to use three PICAXE's, one for each LED.
 

premelec

Senior Member
@lamxe - I have had good success with the 14M2 PICAXE using it's 4 PWMOUTs for driving LEDs - if you need to stick to 8pin device then your approach will be necessary... have fun!
 
Top