Page 1 of 1

LK/VK162-12 with PIC18F8722

Posted: Mon Apr 13, 2009 8:24 pm
by jherrin6
I'm trying to get my PIC18F8722 working with a LK/VK162-12. Below is a snippet of my code:

Code: Select all

IPEN = 0; // Interrupt priorities disabled
PEIE = 1; // enable peripheral interrupts
GIE = 1; 
TRISC = 0xff;
PORTC = 0xff;
	
SSP1STAT = 0x80;
SSP1CON1 = 0x38;
SSP1CON2 = 0x00;
SSP1ADD = 24; //(10MHz/100kHz)/4 - 1 = 24

for(x = 0; x < 60000; x++); //wait for lcd to initiate 

SEN = 1; //send start bit
while(!SSPIF); //wait for interrupt
SSPIF = 0; //then clear it

SSPBUF = 0x50; //i2c address
while(!SSPIF); //wait for interrupt
SSPIF = 0; //then clear it

SSPBUF = 0xfe; //address of register to write to
while(!SSPIF); //wait for interrupt
SSPIF = 0; //then clear it

SSPBUF = 0x58; //clear screen
while(!SSPIF); //wait for interrupt
SSPIF = 0; //then clear it

SSPBUF = 0x4b; //turn cursor off
while(!SSPIF); //wait for interrupt
SSPIF = 0; //then clear it

PEN = 1; //send stop bit
while(!SSPIF); //wait for interrupt
SSPIF = 0; //then clear it 
I never receive an interrupt after I set SEN=1. Any ideas? Thanks in advance for any help.

Posted: Tue Apr 14, 2009 10:34 am
by jherrin6
I'd be happy to provide any additional information.

Posted: Tue Apr 14, 2009 7:18 pm
by jherrin6
After a few hours of banging my head against the wall I finally figured it out. The solution was to add pull-up resistors. Duh!!

Posted: Wed Apr 15, 2009 9:02 am
by Raquel
Hi,

Sorry that we did not get to you quickly.
But I guess what matters most is that you have figured things out.

Best Regards,