Arizona 17 Network Card User Manual


 
PICDEM 17 Demonstration Board Users Guide
DS39024B-page 72 2001 Microchip Technology Inc.
putcUSART2(data); // Print charac-
ter to USART2
return;
}
void main(void)
{
rom int *LEDptr;
unsigned char addr;
unsigned char byte;
char str[5];
char crlf[3];
// Initialize the carriage return/linefeed string
crlf[0] = 0x0d;
crlf[1] = 0x0a;
crlf[2] = 0;
// Initialize the pointer to LEDs
LEDptr = (rom int *)0xfffd;
// Initialize the I2C module
OpenI2C(MASTER,SLEW_ON);
SSPADD = 9;
// Initialize USART2 and hardware handshaking
PORTBbits.RB5 = 1;
DDRBbits.RB5 = 0;
OpenUSART2(USART_TX_INT_OFF&USART_RX_INT_OFF&USART_ASYNCH_MODE&
USART_EIGHT_BIT&USART_CONT_RX,25);
// Print a carriage return and linefeed
PutsUSART2(crlf);
// Initialize address to 0
addr = 0;
while(1)
{
*LEDptr = addr; // Write address
to LEDs
// Write a byte to the EEPROM
EEByteWrite(0xa0,addr,addr);
// Wait for the EEPROM
EEAckPolling(0xa0);
// Read a byte from the EEPROM
byte = EERandomRead(0xa0,addr);
ubtoa(addr,str); // Convert
address to ASCII
PutsUSART2(str); // Print the
string to USART2
PutcUSART2( ); // Print a space
to USART2
ubtoa(byte,str); // Convert the
byte to ASCII
PutsUSART2(str); // Print the
string to USART2