Bit banging with C

Status
Not open for further replies.

Mejinx

New Member
Im trying to bit bang for a lab with the pic18f452 without using use RS232 but i wanna write it in C. How would i go about doing this? thanks
 
The 8051 C compilers I've used have non-standard extensions to C to do sets and clears on bit addressable memory.

A good compiler should recognise something like:

PORT |= 0x01;

as a set bit instruction. Try it and look at the disassembly to see what this C line translates to.
 
Mejinx said:
Im trying to bit bang for a lab with the pic18f452 without using use RS232 but i wanna write it in C. How would i go about doing this? thanks

It's a fine example of why you should use assembler, it's trivial to do, and only takes a few lines.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…