|
Posted by on June 8, 2008, 3:30 pm
> On Fri, 6 Jun 2008 18:23:37 -0700 (PDT), Adam.crash.br...@gmail.com
> wrote:
> >Hi,
> >I'm trying to use a pic 16f876a to control an automated gutter
> >cleaner. Unfortunately I can't even compile my code. I was trying to
> >use sdcc as my compiler, but it doesn't look like it allows for
> >bitwise manipulation and reading of the I/O ports (i.e.
> >PORTBbits.RB2). So I guess I'm looking for a suggestion on a better
> >FREE compiler or a way to do bitwise manipulation of the ports using
> >sdcc. Any suggestions would be greatly appreciated.
> The "Port.BitNum" syntax is a construct that's used by some, but by no
> means all, embedded compilers to manipulate I/O ports.
> You might try a more portable approach, like "Port |= (1 << BitNum)"
> or "Port &= ~(1 << BitNum)" and so on.
> Adjust as necessary for the target processor; I don't recall whether
> that generation of PICs uses separate registers for "the value of the
> port is" and "set the value of the port to".
> --
> Rich Webb Norfolk, VA
Hi,
Thanks so much for the help. I tried both your comments, but still
had problems with MPLAB and a few other compilers. So I've switched
my code to the bitwise operators, and have had success with clearing,
setting, and toggling bits. But, I still can't figure out how to read
an individual bit from the register. Is there an easy way to do this
using bitwise operators, or any other means?
Thanks in advance!
|
>I'm trying to use a pic 16f876a to control an automated gutter
>cleaner. Unfortunately I can't even compile my code. I was trying to
>use sdcc as my compiler, but it doesn't look like it allows for
>bitwise manipulation and reading of the I/O ports (i.e.
>PORTBbits.RB2). So I guess I'm looking for a suggestion on a better
>FREE compiler or a way to do bitwise manipulation of the ports using
>sdcc. Any suggestions would be greatly appreciated.