pic16f876a problem

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.

Reply to
Adam.crash.brown
Loading thread data ...

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

Reply to
Rich Webb

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

Reply to
Philipp Varley

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!

Reply to
Adam.crash.brown

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

Reply to
Rich Webb

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.