PIC
Revision as of 20:13, 10 January 2007 by 192.168.10.10 (talk)
Pic 18F452: I2C Programming W/O interrupts
(Remember to set directon SCK/SDA ports)
Initialization
- Enable Serial Bit = 1 (SSPEN=SSPCON<5>)
- Synchronous Serial Port Mode Select Bits = 1011 (SSPM3-SSPM0=SSPCON<3:0>
Common Start
- Start Enable Bit = 1 ( SEN=SSPCON2<0>)
- DelayMs(1)
- Load Address into SSPBUF
- Test Buffer Full status bit (BF=SSPSTAT<0>)
- loop until buffer bit is cleared
- Test acknowledge bit (ACK=SSPCON2<6>)
- if not acknowleded, abort