tinkerer73
Member level 3
OK, so I'm not a complete newbe with programming, but I don't have much experience in C.
I'm also not new at electronics, but I've never created a circuit using a microcontroller before.
I have a circuit which will be controlling multiple segments of LEDs with PWM at different duty cyles using a PIC16F628A microcontroller.
From what I understand (and please correct wherever I'm wrong here!), there are two output registers, PORTA and PORTB that control multiple pins labeled as RA1, RA2, etc. and RB1, RB2, etc....To activate a pin (thereby activating the appropriate LED), I need to have my program activate the appropriate bit for each pin. There is where I'm lost. I need to know how to tell my program to activate or deactivate a bit in that register. Many years ago, I used to program in assembly, but was by no means ever a pro. IIRC, I had to use the carry bit set or clear and a bit rotator command to set individual bits, but I don't know how to go about it in C.
Also, for the same project, I'll need to know how to check status of input pins as on/off.
I greatly appreciate any help this community can give me!
I'm also not new at electronics, but I've never created a circuit using a microcontroller before.
I have a circuit which will be controlling multiple segments of LEDs with PWM at different duty cyles using a PIC16F628A microcontroller.
From what I understand (and please correct wherever I'm wrong here!), there are two output registers, PORTA and PORTB that control multiple pins labeled as RA1, RA2, etc. and RB1, RB2, etc....To activate a pin (thereby activating the appropriate LED), I need to have my program activate the appropriate bit for each pin. There is where I'm lost. I need to know how to tell my program to activate or deactivate a bit in that register. Many years ago, I used to program in assembly, but was by no means ever a pro. IIRC, I had to use the carry bit set or clear and a bit rotator command to set individual bits, but I don't know how to go about it in C.
Also, for the same project, I'll need to know how to check status of input pins as on/off.
I greatly appreciate any help this community can give me!