Page 1 of 1

Communicating to the GLK12232-25-SM from a PIC Chip

Posted: Thu Jan 17, 2008 2:15 pm
by Trent
I want to control my GLK12232-25-SM display using a 18F4520 PIC chip. I have tried to send the display simple commands to see if I am communicating to it and it doesn't seem to accept what I send. My questions are:

1.Do I need a RS232 communication chip between my PIC chip and the display for the transmit and receive pins?

2.How do you send characters to the display? The manual isn't very clear about that. I would like a little sample code in C that shows the lines of code that is used to send commands then characters.

Here is my little test code that I was trying to use. I am sending a Clear Screen, a Text Insertion Point to the top left, then I am sending each letter of my name followed by a delay before the next letter. I am not sure if I am sending the characters correctly. I am trying to send the characters in Hexadecimal form. Do I need to select my font first?

while(1)
{

WriteUSART(0xFE);
WriteUSART(0x58);
WriteUSART(0xFE);
WriteUSART(0x48);
WriteUSART(0x54);
for(x=0;x<10000;x++);
WriteUSART(0x52);
for(x=0;x<10000;x++);
WriteUSART(0x45);
for(x=0;x<10000;x++);
WriteUSART(0x4E);
for(x=0;x<10000;x++);
WriteUSART(0x54);

}

Posted: Fri Jan 18, 2008 10:24 am
by Clark
Hi Trent,

Thanks for your question, sorry to hear that you are having some trouble displaying to your GLK12232-25-SM through your 18F4520 PIC.

1. The display is capable of full serial communication using the RS232 protocol, so as long as your PIC can communicate with that protocol, you will not need a transceiver in between the two.

2. To send characters to the display, just output their ascii value in hexadecimal form. The code you've posted should do the trick, providing communication protocol is correct.

As for your code, no you do not need to select a font first, the font stored in storage slot 1 will be used by default. You should, however, make sure you have a font loaded :wink: . Try using a PC and uProject to ensure your display is functioning correctly before implementing it into your PIC application. In addition, you may want to add a delay in between your commands as well; all communication is buffered, but a little extra time between commands will ensure that the buffer is never filled. Finally, you may need to adjust some of the registers on your PIC to ensure that is communicates using the settings the display expects.

Baud Rate: 19200 (by default)
Start Bits: 0
Stop Bits: 1
Parity: None
Flow Control: Off
Data: Hexadecimal values (you're on the right track here)

Finally, one last suggestion, again you may want to isolate the two parts using uProject and Hyperterminal before combining them. Hope that information will help you move forward in your design, if you run into any more trouble, feel free to post here.

Thanks,

Troy

Using USART

Posted: Fri Jan 18, 2008 11:33 am
by Trent
I am almost positive that I have the PIC chip set up properly using the USART capability. I do notice that when I connect the transmit pin from the display to the receive pin of the PIC chip the startup screen of the display goes away. I have hooked up a oscilloscope and have seen the changing message that is being sent out of the PIC chip. I will try to hook up the PIC chip to hyperterminal but I think the way I have it hooked up should work. One thing I noticed is that the transmit pin from the PIC chip is always high. I didn't know if the display needs to see a low then the first command since the first command is always 0xFE and that would make the first bit a 1. Anymore help or direction would be greatly appreciated. Thanks for the previous post Troy.

Posted: Fri Jan 18, 2008 1:29 pm
by Clark
Hi Trent,

Thanks for the update, sorry to hear that you are still having some trouble communicating to your display. In addition to the attributes mentioned before, one of my colleagues has suggested that you ensure the PIC is communicating using RS232 voltage levels, rather than 0 and 5 volt TTL settings. As for the transmit pin, according to your code it should be high for the first command you send; it looks like your PIC uses a NRZ transmission technique. You may want to try a couple characters before issuing commands; they will write over the startup screen starting at the top left, but it will allow you to get a better initial reading from the scope. Hopefully that helps get your project moving, keep us posted with updates, and we'll do what we can to help you realize the full potential of that little GLK12232-25-SM display.

Thanks,

Troy

TTL logic

Posted: Fri Jan 18, 2008 1:37 pm
by Trent
My PIC is putting out a 0 to 5V signal. I noticed the RS232 connection on the back of the display is jumpered with resistors, do I need to transfer the resistors to TTL solder pads or just use solder to make the connection between the pads? Thanks for the help. I am sure that this is the issue with my problems.

Posted: Fri Jan 18, 2008 2:52 pm
by Clark
Hi Trent,

The TTL signal could very well be the root of the communication problems that you have been experiencing. The resistors on those pads are 0 ohms, so you can use solder to make the connections, and in fact it is much easier :wink: . Hope that helps, let me know how it all turns out.

Thanks,

Troy