Hi
I’m playing around with some LED’s on a 16f630 and I’m just wondering if there is an easier way to do the things I do. It might be a simple question for some, but I never really figured it out yet.
If I want to turn on one LED after another, I normally use something like thins inside a while and with a sleep ofc.
PORTA = 0b000001;
PORTA = 0b000010;
PORTA = 0b000100;
Other times I use RA0 = 1; RA1 = 0; and so on for every LED. It’s working fine and all, but I’m wondering if there are better, more efficient ways to do this?
And what if I want to use both PORT A and C
PORTA = 0b000001;
PORTA = 0b000010;
PORTA = 0b000100;
PORTA = 0;
PORTC = 0b000001;
PORTC = 0b000010;
PORTC = 0b000100;
PORTC = 0b001000;
PORTC = 0;
Are there any special functions to run through the ports like that?
I have read about bit shifting, but I’m not sure this is what I’m looking for. I have played around with it, but never made it work, so maybe someone could give me an example if it’s actually what I’m looking for.
I use Hitech C and MPLab for my programs.
Thx.