I2C newbie need sample code on slave mode in C

Nov 30, 2008 1 Replies

Hey all,



I'm new to microcontrollers and I need to program my microchip PIC18F2321 to communicate via I2C with a processor so I can turn the radio's power on or off or set a specific frequency for the radio to operate on.


I read microchip's sample code for programming master mode as well as the AN734 doc. I'm still confused as to what to do. I've never done any hardware programming before other than simple projects in LC-3 assembly in college.


Does anyone have any example code on how to set your device to be the slave and let it talk to the master I2C in C programming language and NOT assembler? (How do you even determine the address of the node?)


Thanks so much! Happy Thanksgiving!



Morgan


n
n

Different C compilers might have different ways to access the registers. There is probably some documentation on how to do that that came for the C compiler you are using. Some C compilers let you stick in assembly language code as well. I couldn't find a datasheet on the

18F2321.

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required