LK204-25 clear display trouble

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
Macabra
LCD?
Posts: 7
Joined: Wed Sep 10, 2008 2:04 am

LK204-25 clear display trouble

Post by Macabra »

Hi! :)

I've been trying to make my LCD (LK204-25) clear it's screen. I'm using a PIC (PIC24HJ12GP201) to connect to my LCD. I think I read through the forum that PICs output as TTL so the LCD would have to have the jumpers soldered for TTL is this correct? I've changed to TTL and just as trying with Serial RS-232, I get nothing, just the original screen stating (Matrix Orbital and model number displayed). Before changing it to TTL, I've used my program to output on hyperterminal and it works, but trying to display it on LCD has been nothing less than a nightmare :(. I've been asking for assistance with my colleagues and they are just as clueless as to why it does not work. The following is my code (it is very small for I only want to clear screen).

#include <p24hj12gp201.h>
#include <stdlib.h>
#include <stdio.h>
#include <uart.h>

#define FCY 25000000
#define BAUDRATE 19200
#define BRGVAL ((FCY/BAUDRATE)/16)-1



///////////////////////////////////////////////////////////////////
int main ()
{
PORTBbits.RB4 = 1;

///***************************
// Assign U1Rx To Pin RP0
//***************************
RPINR18bits.U1RXR = 0;
//***************************
// Assign U1CTS To Pin RP1
//***************************
RPINR18bits.U1CTSR = 1;
//***************************
// Configure Output Functions
// (See Table 9-2)
//***************************
//***************************
// Assign U1Tx To Pin 11
//***************************
RPOR4bits.RP8R = 3;
//***************************
// Assign U1RTS To Pin 12
//***************************
RPOR4bits.RP9R = 4;
PLLFBD=38; // M=40
CLKDIVbits.PLLPOST=0; // N1=2
CLKDIVbits.PLLPRE=0; // N2=2
RCONbits.SWDTEN=0; // Disable Watch Dog Timer
while(OSCCONbits.LOCK!=1) {}; // Wait for PLL to lock
U1MODEbits.STSEL = 0; // 1-stop bit
U1MODEbits.PDSEL = 0; // No Parity, 8-data bits
U1MODEbits.ABAUD = 0; // Autobaud Disabled
U1MODEbits.BRGH = 0; // Low Speed mode
U1BRG = BRGVAL; // BAUD Rate Setting 19200
U1STAbits.UTXISEL1 = 0;
U1MODEbits.UARTEN = 1; // Enable UART
U1STAbits.UTXEN = 1; // Enable UART Tx


WriteUART1(254); //send to Clear Display
WriteUART1(88); //Fail :(
}

Much thanks for your assistance on this matter
Michel
Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Michel,

Sorry to hear you are having trouble running your LK204-25 using that PIC24HJ12GP201 IC. Unfortunately, I haven't worked with that particular PIC, I can't say much for most of the code at the beginning.

As far as the LCD is concerned, you'll want to make sure that the values are output as bytes. You'll also want to have flow control turned off. Finally, a look at the data sheet for that PIC should hopefully let you know for sure which levels, standard or TTL, the device communicates at so you can set the display accordingly.

You may want to start by issuing text until you get the communication sorted out, it's a little easier, and you can tell right away what is being received. Also, check out our App Notes section for some sample code that might provide an insight into programming with that LCD.

If you have any more trouble with that display, please just post up any new information and I'm sure we'll be able to work out the problem.

Thanks,
~Troy
Troy Clark
Design & Development
Matrix Orbital
Macabra
LCD?
Posts: 7
Joined: Wed Sep 10, 2008 2:04 am

Post by Macabra »

Thanks Troy for looking over my problem I really appreciate it! :)

Thanks for letting me know about the flow control I will make those changes and let you know of what happened. I have my PIC connected to a MAX3232 which converts TTL singnals to common RS-232 and from there I have it connected to the LCD. Now, it works when I connect that output to the hyperterminal of any computer, but it does not work for LCD. Perhaps it is due to the flow control ;) haha I cross my fingers.
Macabra
LCD?
Posts: 7
Joined: Wed Sep 10, 2008 2:04 am

Post by Macabra »

Troy, much thanks

I added a line of code to shut off flow control and that did it..for the most part. Now I can print to screen! XD ...except that..when i turn off the LCD and turn it back on it prints weird character non stop ..another thing to tackle but finally got something going. Much thanks!!
Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Michel,

No worries, I'm glad you've got at least some function to that screen. It looks like the rest of the problem may lie in the code, possibly some old characters left in a buffer somewhere, so I'll leave that to you. If you do need any further help with that display, just put up another post.

~Troy
Troy Clark
Design & Development
Matrix Orbital
Post Reply