View previous topic :: View next topic |
Author |
Message |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
graphic lcd problem |
Posted: Fri Jun 09, 2006 7:16 am |
|
|
i ıse 240*128 lcd screen with t6963 controler.. and i want to use only graphic mode
my problem is when give clear screen my screen still some..
what is the promlem thanks..
[code]
#define cnt port_b;
const int16 TextHome = 0x0780;
const int8 TextArea = 0x001E; // how many bytes before a new line
const int16 GraphicsHome = 0x0000;
const int8 GraphicsArea = 0x001E; // how many bytes before a new line
const int8 AutoModeWrite = 0xB0;
const int8 AutoModeRead = 0xB1;
const int8 AutoModeReset = 0xB2;
const int8 LCDModeSet = 0x80; // send this OR'd with the following
const int8 LCDMode_OR = 0b0000;
const int8 LCDMode_XOR = 0b0001;
const int8 LCDMode_AND = 0b0010;
const int8 LCDMode_TA = 0b0100; // TEXT ATTRIBUTE mode.
const int8 LCDMode_RAM = 0b1000; // 1=CG RAM, 0=internal CG ROM
const int8 LCDSetCursorPtr = 0x21; // cursor address
const int8 LCDSetCursorSize = 0xA0; // 1 line cursor
const int8 LCDDispMode = 0x90; // send this OR'd with the following
const int8 LCDDisp_BLK = 0b0001;
const int8 LCDDisp_CUR = 0b0010;
const int8 LCDDisp_TXT = 0b0100;
const int8 LCDDisp_GRH = 0b1000;
struct lcd_pin_def
{
BOOLEAN unused1; //B0
BOOLEAN unused2; // B1
BOOLEAN unused3; // B2
BOOLEAN CE; // B3
BOOLEAN WR; // B4 Write bar active low
BOOLEAN RD; // B5 Read bar active low
BOOLEAN CD; // CB6 Command/Data BAR 1=command 0=data
BOOLEAN RST; // B7 Reset active low
int data : 8; // PortD=Data bus
};
struct lcd_pin_def LCD;
#byte LCD = 0xf07 // portB address on 16F877
void LCD_INITILAZE(void);
void wrdata(unsigned char data);
void wrcommand(unsigned char data);
void LCD_clear_graph(void);
void main()
{
char i;
char k;
i=0;
k=0;
set_tris_d (0xff);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_tris_b (0X00);
lcd.rd=1;
LCD_INITILAZE();
LCD_clear_graph();
wrcommand(LCDDispMode);
wrcommand(LCDDisp_GRH);
}
LCD_INITILAZE(void)
{
int GR_HOME_ADDRESS ;
LCD.CE=1; //SET ce
LCD.WR=1; //SET wr
LCD.CD=1; // SET cd
LCD.RST=0;
DELAY_US(5);
LCD.RST=0;
//set graphic home adress
wrdata(GraphicsHome);
wrdata(GraphicsHome>>8);
wrcommand(0x42);
//set graphic area
wrdata(GraphicsArea);
wrdata(GraphicsArea>>8);
wrcommand(0x43);
// SET THE ADREESS POINTER
wrdata(0);
wrdata(0);
wrcommand(0x24);
wrdata(0);
wrdata(0);
wrcommand(0x24);
}
LCD_clear_graph(void)
{
int16 counter;
// Clear all RAM of LCD (8k)
wrcommand(AutoModeWrite);
for (counter = 0; counter < 0x1fff; counter++)
{
wrdata(0x00); // fill everything with zeros
}
wrcommand(AutoModeReset);
}
wrdata(unsigned char data)
{
LCD.CD=0; //clear ce
output_d (data);
set_tris_d (0x00);
LCD.RD=1;//SET READ
LCD.CE=0; //clear ce
LCD.WR=0; //clear wr
delay_us(1);
LCD.CE=1; //SET ce
LCD.WR=1; //SET wr
LCD.CD; // SET cd
LCD.RD=0;//SET READ
set_tris_d (0xff);
}
wrcommand(unsigned char data)
{
LCD.CD=1; //set cd
output_d (data);
set_tris_d (0x00);
LCD.RD=1;//SET READ
LCD.CE=0; //clear ce
LCD.WR=0; //clear wr
delay_us(1);
LCD.CE=1; //SET ce
LCD.WR=1; //SET wr
LCD.CD=1; // SET cd
LCD.RD=0;//SET READ
set_tris_d (0xff);
}
[/code] |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 09, 2006 7:50 am |
|
|
The drivers were written for a hantronix 240x64.
You are using a 240x128.
You understand some parameters must be changed. |
|
![](templates/subSilver/images/spacer.gif) |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
which parmeter must be change |
Posted: Mon Jun 12, 2006 2:35 am |
|
|
for graphic mode
Collumds are some so graphhic area is same
42h<====240/8=30=0x001e
pointer adress is same
24h<====0x0000
which parameters more must be change? |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Jun 12, 2006 8:29 am |
|
|
Start with a basic command. RESET.
How is your reset done?
There is a Pin for reset_bar.
If your display starts up with characters on it and you reset it do they get cleared?
Then move to a writebyte. This is needed to do the setup. perhaps your
display needs more time in the delays. You are just going to have to debug this like you would anything else. |
|
![](templates/subSilver/images/spacer.gif) |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
|
Posted: Mon Jun 12, 2006 8:41 am |
|
|
i define reset bar like that
struct lcd_pin_def
{
BOOLEAN unused1; //B0
BOOLEAN unused2; // B1
BOOLEAN unused3; // B2
BOOLEAN CE; // B3
BOOLEAN WR; // B4 Write bar active low
BOOLEAN RD; // B5 Read bar active low
BOOLEAN CD; // CB6 Command/Data BAR 1=command 0=data
BOOLEAN RST; // B7 Reset active low
int data : 8; // PortD=Data bus
};
struct lcd_pin_def LCD;
#byte LCD = 0xf06 // portB address on 16F877
///-------------------
and reset kike this:
LCD.RST=0;
DELAY_mS(5);
LCD.RST=1;
I will all use only graphic mode..
And can not chance lcd screen with the command.
Any thing i must do more? |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Jun 12, 2006 8:55 am |
|
|
What processor? |
|
![](templates/subSilver/images/spacer.gif) |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
|
Posted: Mon Jun 12, 2006 11:31 am |
|
|
i'm using pıc16f977a
and lcd module chip is t6963c |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Jun 12, 2006 12:21 pm |
|
|
Your on your own with that one.
Quote: | i'm using pıc16f977a
and lcd module chip is t6963c |
16F977A is not a microchip part.
If instead you have 16F877A then the #byte needs to be set to the port you are using. See spec page 19
for example port C is at 0x07 so..
#byte LCD = 0x07
NOT
#byte LCD = 0xf07 |
|
![](templates/subSilver/images/spacer.gif) |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
|
![](templates/subSilver/images/spacer.gif) |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
|
Posted: Thu Jun 15, 2006 9:00 am |
|
|
And my new program is:
#include <16F877A.h>
#use delay(clock=20000000)
const int16 TextHome = 0x0780;
const int8 TextArea = 0x001E; // how many bytes before a new line
const int16 GraphicsHome = 0x0000; ///// degistirdim normlade 0x0000
const int8 GraphicsArea = 0x001E; // how many bytes before a new line
const int8 AutoModeWrite = 0xB0;
const int8 AutoModeRead = 0xB1;
const int8 AutoModeReset = 0xB2;
const int8 LCDModeSet = 0x80; // send this OR'd with the following
const int8 LCDMode_OR = 0b0000;
const int8 LCDMode_XOR = 0b0001;
const int8 LCDMode_AND = 0b0010;
const int8 LCDMode_TA = 0b0100; // TEXT ATTRIBUTE mode.
const int8 LCDMode_RAM = 0b1000; // 1=CG RAM, 0=internal CG ROM
const int8 LCDSetCursorPtr = 0x21; // cursor address
const int8 LCDSetCursorSize = 0xA0; // 1 line cursor
const int8 LCDDispMode = 0x90; // send this OR'd with the following
const int8 LCDDisp_BLK = 0b0001;
const int8 LCDDisp_CUR = 0b0010;
const int8 LCDDisp_TXT = 0b0100;
const int8 LCDDisp_GRH = 0b1000;
struct QWE
{
BOOLEAN A0; //B0
BOOLEAN A1; // B1
BOOLEAN A2; // B2
BOOLEAN A3; // B3
BOOLEAN A4; // B4 Write bar active low
BOOLEAN A5; // B5 Read bar active low
BOOLEAN A6; // CB6 Command/Data BAR 1=command 0=data
BOOLEAN A7;// B7 Reset active low
int data : 8; // PortD=Data bus
};
struct QWE PORTA;
#byte PORTA = 0x05 // portB address on 16F877
struct lcd_pin_def
{
BOOLEAN unused1; //B0
BOOLEAN unused2; // B1
BOOLEAN unused3; // B2
BOOLEAN CE; // B3
BOOLEAN WR; // B4 Write bar active low
BOOLEAN RD; // B5 Read bar active low
BOOLEAN CD; // CB6 Command/Data BAR 1=command 0=data
BOOLEAN RST; // B7 Reset active low
int data : 8; // PortD=Data bus
};
struct lcd_pin_def LCD;
#byte LCD = 0x06 // portB address on 16F877
void LCD_INITILAZE(void);
void wrdata(unsigned char data);
void wrcommand(unsigned char data);
void LCD_clear_graph(void);
void main()
{
char i;
char k;
set_tris_a (0x00);
set_tris_b (0x00);
set_tris_d (0x00);
i=0;
k=0;
LCD=0xFF;
PORTA=0xFF;
LCD_INITILAZE();
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
while (1)
{
LCD_clear_graph();
}
wrcommand(LCDDispMode);
wrcommand(LCDDisp_GRH);
}
LCD_INITILAZE(void)
{
LCD.CE=1; //SET ce
LCD.WR=1; //SET wr
LCD.CD=1; // SET cd
LCD.RST=0;
//DELAY_mS(5);
LCD.RST=1;
//set graphic home adress
wrdata(GraphicsHome);
wrdata(GraphicsHome>>8);
wrcommand(0x42);
//set graphic area
wrdata(GraphicsArea);
wrdata(GraphicsArea>>8);
wrcommand(0x43);
// SET THE ADREESS POINTER
wrdata(0);
wrdata(0);
wrcommand(0x24);
}
LCD_clear_graph(void)
{
int16 counter;
// Clear all RAM of LCD (8k)
//wrcommand(AutoModeWrite);
for (counter = 0; counter < 0x0f00; counter++)
{
wrdata(0x0F); // fill everything with zeros
wrcommand(0Xc0);
}
//wrcommand(AutoModeReset);
}
wrdata(unsigned char data)
{
LCD.CD=0; //clear ce
output_d (data);
set_tris_d (0x00);
LCD.RD=1;//SET READ
LCD.WR=0; //clear wr
LCD.CE=0; //clear ce
delay_us(1);
LCD.CE=1; //SET ce
LCD.WR=1 ; //SET wr
LCD.CD=1; // SET cd
LCD.RD=0;//SET READ
set_tris_d (0xff);
}
wrcommand(unsigned char data)
{
LCD.CD=1; //set cd
output_d (data);
set_tris_d (0x00);
LCD.RD=1;//SET READ
LCD.WR=0; //clear wr
LCD.CE=0; //clear ce
delay_us(1);
LCD.CE=1; //SET ce
LCD.WR=1; //SET wr
LCD.RD=0;//SET READ
set_tris_d (0xff);
} |
|
![](templates/subSilver/images/spacer.gif) |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
|
Posted: Thu Jun 15, 2006 9:09 am |
|
|
i want to use all in graphic mode
and my algoritm is to begin is thant
//////////////////////////////////for initilase
// setting graphic home adress
send data 0x00
send data 0x00
send command 0X42h
// set graphic area
send data 0x1e//===> 240/8=30 number of columb
send data 0x00
send command 0X43h
// setting adrees pointer
send data 0x00
send data 0x00
send command 0X24h
// set auto write mod
send command 0xb0
send all data //all data tjat i want to write
send command 0xb2
///////////////
what me fault, i could not understan still..
please help me!!!!! |
|
![](templates/subSilver/images/spacer.gif) |
Barnie Guest
|
- |
Posted: Sat Jun 17, 2006 7:11 am |
|
|
Hi,
this one page data sheet is not enough! Vee and Vo are very important:
Vee is output of internal dc-dc converter
Vo is input for negative supplay from Vee
you should look for better data sh. but for now connect Vee and Vo by
22K var resistor and adjust Lcd screen to look grafik depending your above prog
Best, |
|
![](templates/subSilver/images/spacer.gif) |
epideath
Joined: 07 Jun 2006 Posts: 47
|
|
Posted: Sat Jun 17, 2006 9:04 am |
|
|
Here is my code for clearing the graphics area. I use a 128x128 display so total amount to clear may be more.
But when I look in your code i don't see the wait for STA3.
Code: |
void LCD_ClearGraphics(void)
{
int16 i;
//Address 0x1000 is the start of my graphics area.
LCD_Command2(0x24, 0x00, 0x10); //Move to start of Graphic Area
LCD_Command0(0xB0); //Set auto data write
for(i = 0; i < 2816; i++) //Increment through entire graphic area (22x128)
{
LCD_ReadySTA3();
LCD_Write(0x00);
}
LCD_ReadySTA3();
LCD_Command0(0xB2);
}
|
Gary |
|
![](templates/subSilver/images/spacer.gif) |
|