PICcoder.co.uk Forum  


::post new topic::
New to PIC and I2C Help Please
Date: 2007/02/01 16:04 By: Ben Rowe Status: Visitor  
 
Hi there having a problem with this code just trying to get my head arround the pics and the I2C protocol. Im currently using a PIC DEM 2+ board from Microchip with MPLAB and connecting to the onboard I2c temp sensor using the c18 compiler. i get a responce but its always a '.' ?? any ideas
thanks
ben
ps heres the code:

#include <p18f452.h>
#include <usart.h>
#include <i2c.h>

#pragma config WDT = OFF

void main (void)
{
unsigned char x;
OpenUSART( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
25 );

OpenI2C(MASTER, SLEW_ON);
StartI2C();
x = getsI2C('1000000b', 10);
putrsUSART(x);
StopI2C();
}
reply | quote


      Topics Author Date
    emo
New to PIC and I2C Help Please
Ben Rowe 2007/02/01 16:04
    thread link
thread linkthread link Re:New to PIC and I2C Help Please
dariog 2007/02/20 21:30
::post new topic::