Ahh, the Graphic on T6963C based LCD

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
norbie
Posts: 160
Joined: 06 May 2006 22:40
Location: Vista, California

Ahh, the Graphic on T6963C based LCD

#1 Post by norbie » 28 Nov 2008 01:28

Hi,
I have been fighting undesired artifacts (':oops:') on a T6963C based LCD and can't get a handle on it. I am reaching out for help, primarily a sanity check :roll:. In the course I have written a short program for an PIC24HJ256GP210 MCU. If anyone would like to try to reproduce what I see and confirm, would be great. If it can't be reproduced then I might have to look for another LCD although I am convinced that it is not the piece of hardware. What I see is that initially the screen is drawn correctly (but I have also seen mishaps at first draw totally at random :shock:) and after a few repetitions the screen gets messed up. Sometimes, LCD commands don't make it and parts of Graphics memory get messed up too.
Here is the code:

Code: Select all

/****************************************************************************************
 ***  This short application produces an irregular behavior by not printing  certain ****
 ***  Text then again it does and messing up the Graphical box (white)               ****
 ***  It seems as if text ROM Data is bleeding or misrouted into RAM ?               ****
 ***  Some LCD commands are simply not executed                                      ****
 ***  I had the LCD setup directly to 3.3V and using a 3.3V to 5V translator         ****
 ***  with the same results.                                                         ****
 ***  The LCD is a CrystalFontz CFAG240128L-STI-TZ Monochrome 240x128  device        ****
 ***  LCD setup times (various) are according to Spec Sheet between 10-100nS         ****
 ***  Furthermore the input(min) high voltage is VDD-2.2 V i.e. 5-2.2 = 2.8 V        ****
 ***  If run on 3.3 > 2.8 Volt the high level is fully satisfied unless reshaped     ****
 ***  by stray Capacitance. It's got to be quiet some Capacitor                      ****
 ***  The input low voltage is between 0.3 and 0.8 (max) Volts.                      ****
 ***  I did try several different LCD's of same model, all got messed up             ****
 ***  therefore I don't believe that the Hardware has a problem                      ****
 ****************************************************************************************/

// The MCU used for this application is a PIC24HJ256GP210 with external Crystal at 16MHz

#include "T6963C.h"
unsigned long clk;
char txt[5];

void puts(char *msg, int pos, int lin);
void bottom_menu(char *msg);

void cls() {
T6963C_panelFill(0);
}

void bottom_menu(char *msg) {
T6963C_WRITE_TEXT(msg, 1, 15, T6963C_ROM_MODE_XOR);
}

void DispOn() {
char text[] = "Error!";
T6963C_waitready();
puts(text, 1, 0);
puts(text, 15, 0);
puts(text, 30, 0);
T6963C_waitready();
puts(text, 1, 5);
puts(text, 15, 5);
puts(text, 30, 5);
T6963C_waitready();
puts(text, 1, 10);
puts(text, 15, 10);
puts(text, 30, 10);
}
void DispOff() {
T6963C_waitready();
puts("                                       ", 1, 0);
puts("                                       ", 1, 5);   // 39 Chars of 0x20
puts("                                       ", 1, 10);
T6963C_waitready();
}

void init_app() {
/* below will set MCU for 80MHz - 40Mips with 16MHz external Crystal */
/* 16MHz / 2 = 8MHz -- 8MHz * 20 = 160 MHz -- ouput 160 MHz / 2 = 80 MHz */

CLKDIV = 0x0000;     // Divide input by 2 and divide output by 2
PLLFBD = 0x0012;     // Multiply FCY by 20
/* Comment the above and set project to 16MHz to try it at slower speeds
   don't forget the Project to change to FNOSC_PRI */

AD1PCFGL = 0xFFFF; /* Disable ADC module */
AD1PCFGH = 0xFFFF; /* Disable all ADC channels */

TRISA    = 0x0000; /* Configure PORTA as digital outputs */
}

void puts(char *msg, int pos, int lin) {
T6963C_WRITE_TEXT(msg, pos, lin, T6963C_ROM_MODE_XOR);
}
// Display gets messed up with only those few instruction at Base clock 16MHz
void main() {
init_app();
LATBbits.LATB13 = 1;     // Sets the Font Select Bit to 6x8
/* LCD connected to
PORTB(L) "data" --
PORTB(H) "control"  Pin 8 = /WR Pin 9 = /RD Pin 11 = C/D Pin12 = RST
 this would be the 128x64 adapter with the reverse display select to ground */

T6963C_init(240, 128, 6, &PORTB, &PORTB, 8, 9, 11, 12);
T6963C_text(1);

// Also observe screen while Graphics is disabled
T6963C_graphics(1);     // Important --- Less likely to fail if Text only selected
cls();

T6963C_box(0, 119, 239, 127, T6963C_WHITE);
T6963C_box(0, 0, 239, 7, T6963C_WHITE);
bottom_menu("DIM APRS LIST GPS");

clk = Clock_Khz();
clk = clk / 1000;
if(clk > 16) {
LongToStr(clk, txt);    // Get the clock in kHz and convert to MHz
puts(txt, 20, 15);
puts("MHz PLL", 32,15);
}
else {
LongToStr(clk, txt);    // Get the clock in kHz and convert to MHz
puts(txt, 20, 15);
puts("MHz", 32,15);
}

/* just loop around */
while(1) {
DispOn();
delay_ms(500);
DispOff();
delay_ms(250);
 }

}
/*~ Pretty much messed up at Dynamic refreshes */
I am using the LV 24-33 Development system and a 128x64 adapter slightly modified (Background select pin tied to Ground for black background). LCD is on PORTB LOW(DATA) PORTB HIGH(CONTROL)
This code is complete, compiles and runs if connected correctly.
Anyone interested?
Cheers,
Norbert

You don't need to know the answer, you just need to know where to find it!

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”