pic16f876a problem

Jun 07, 2008 4 Replies

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

Why not using the Microchip software? MPLab for example. Or microC, which is free I think (use google to find, or give me a note via email and I'll send it over)

Cheers, Phil

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!

For instances like if (bit 3 is set in FOO_REG) then do something you can use #define BAR_BIT 3 if (FOO_REG & (1

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required