LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series
Moderators: Henry, Mods
-
jherrin6
- LCD?
- Posts: 3
- Joined: Mon Apr 13, 2009 8:17 pm
Post
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.
-
jherrin6
- LCD?
- Posts: 3
- Joined: Mon Apr 13, 2009 8:17 pm
Post
by jherrin6 »
I'd be happy to provide any additional information.
-
jherrin6
- LCD?
- Posts: 3
- Joined: Mon Apr 13, 2009 8:17 pm
Post
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!!
-
Raquel
- Matrix Orbital

- Posts: 834
- Joined: Thu Aug 19, 2004 3:37 pm
- Location: MO Office
Post
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,
Raquel Malinis
Design and Development
Matrix Orbital