timothyjackson
New Member
Trying to use a PIC to create a fading/dimming of 3 leds (well i want to fade 7 at different rates, but will start with 3)
I understand how to fade/dim on and off 1 LED using several levels of PWM, each having a slightly brighter effect.
But, fading 3 leds at different times?
I have an idea on how to do it, but, I think it is far to complex:
00000001 (send this to the LED port, turning on LED 0)
wait 5ms
00000000
wait25ms
repeat 16 times (PWM level 1 for LED 0)
00000001
wait 10ms
00000000
wait 20ms
repeat 16 times (PWM level 2)
00000001
wait 15ms
00000000
wait 15ms
repeat 16 times (PWM level 3)
00000101 (LED 2 now begins PWM level 1, and LED begins PWM level 4)
wait 5ms
00000001
wait 15ms
00000000
wait 10ms
00000101
wait 5ms
00000001
wait 15ms
etc etc etc
Continue assigning "XXXXXXXX" to the port to control the LED states, and call certain millisecond delays to control the invidual PWM's.
I think this is a little complex.?.
How many instruction lines are possible in a 16F628?
:? :?
I understand how to fade/dim on and off 1 LED using several levels of PWM, each having a slightly brighter effect.
But, fading 3 leds at different times?
I have an idea on how to do it, but, I think it is far to complex:
00000001 (send this to the LED port, turning on LED 0)
wait 5ms
00000000
wait25ms
repeat 16 times (PWM level 1 for LED 0)
00000001
wait 10ms
00000000
wait 20ms
repeat 16 times (PWM level 2)
00000001
wait 15ms
00000000
wait 15ms
repeat 16 times (PWM level 3)
00000101 (LED 2 now begins PWM level 1, and LED begins PWM level 4)
wait 5ms
00000001
wait 15ms
00000000
wait 10ms
00000101
wait 5ms
00000001
wait 15ms
etc etc etc
Continue assigning "XXXXXXXX" to the port to control the LED states, and call certain millisecond delays to control the invidual PWM's.
I think this is a little complex.?.
How many instruction lines are possible in a 16F628?
:? :?