kanni1303
Full Member level 3
- Joined
- Jun 29, 2012
- Messages
- 164
- Helped
- 12
- Reputation
- 24
- Reaction score
- 11
- Trophy points
- 1,298
- Location
- Chennai, Tamil Nadu, India
- Activity points
- 2,718
Hi all,
I want to generate variable PWM (to blink LED fade in and fade out) on multiple GPIO pins. With this I could able to get, but the signal generated is sequential. Like A -> B -> C -> D. I want all these should go in parallel. I know that if I use PWM then I can get it. But my requirement is to generate on maximum pins possible :bangon all pins with different variable PWM not grouped as ports).
I tried with 18f4550 nad 16f877a - where I get 30 pins
I want to generate variable PWM (to blink LED fade in and fade out) on multiple GPIO pins. With this I could able to get, but the signal generated is sequential. Like A -> B -> C -> D. I want all these should go in parallel. I know that if I use PWM then I can get it. But my requirement is to generate on maximum pins possible :bangon all pins with different variable PWM not grouped as ports).
I tried with 18f4550 nad 16f877a - where I get 30 pins
Code:
for (dutyCycle1 = 0; dutyCycle1 < period1; dutyCycle1++) {
PORTA = 0x3E;
for (itr = 0; itr < (period1 - dutyCycle1); itr++);
PORTA = 0x00;
for (itr = 0; itr < (dutyCycle1); itr++);
}
PORTA = 0x00;
for (dutyCycle1 = 0; dutyCycle1 < period1; dutyCycle1++) {
PORTB = 0x00;
for (itr = 0; itr < (period1 - dutyCycle1); itr++);
PORTB = 0xFF;
for (itr = 0; itr < (dutyCycle1); itr++);
}
PORTB = 0xFF;
for (dutyCycle1 = 0; dutyCycle1 < period1; dutyCycle1++) {
PORTC = 0x00;
for (itr = 0; itr < (period1 - dutyCycle1); itr++);
PORTC = 0xFF;
for (itr = 0; itr < (dutyCycle1); itr++);
}
PORTC = 0xFF;
for (dutyCycle1 = 0; dutyCycle1 < period1; dutyCycle1++) {
PORTD = 0x00;
for (itr = 0; itr < (period1 - dutyCycle1); itr++);
PORTD = 0xFF;
for (itr = 0; itr < (dutyCycle1); itr++);
}
PORTD = 0xFF;
Last edited: