All pastes #2069629 Raw Edit

Mine

public text v1 · immutable
#2069629 ·published 2011-05-26 20:51 UTC
rendered paste body
#include <p18f4220.h>
#include <delays.h>
#include <i2c.h>
#pragma config OSC=INTIO2, WDT=OFF, LVP=OFF, DEBUG=ON

void main()
{
	// Variable Declarations
	unsigned char data[] = "Hello";
	
	// Oscillator settings
	OSCCON = 0x70;		// OSC = 8 MHz
	while(!OSCCONbits.IOFS);		// Wait for OSC to be ready
	
	//ADCON1 = 0x0F;		// Digital Mode
	TRISC = 0x0C;		// RC3 = SCL, RC4 = SDA
	
	OpenI2C(MASTER, SLEW_OFF);
	SSPADD = 19;		// 100 kHz @ 8 MHz
	
	while(1)
	{
		StartI2C();
		putsI2C(data);
		AckI2C();
		StopI2C();
	}
}