Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/19/02 15:15
Read: times


 
#24624 - help using LCD module problem!
hi,is there anybody using dot matrix LCD module? i have a LCD module made by
TianMa company , the controller is HD61202U,the display mode is 128x64,my
cpu is Analog Devices AduC824 run at 12MHz,i can see the led
toggled as i expected,but i can't see anything on the screen,i checked
the interface connection and the driving voltage,but they are ok,so i
suspect if there are something wrong with the code,i attached the code in
this email as following:
can anyone help me out?

code example:

#include "ADuC824.h"

/*--------------------------------------------------------------------
TM12864BBCW7 interface to ADuC824 (12MHz core frequency) configuration
LCD controller: HD61202U, display mode : 128x64
VSS ------- DGND
VDD ------- DVDD(+5V)
V0 ------- 5kohm adj + 1k fix ohm, 1k to gnd, 5k to Vout(-10V)
D/I ------- P2.0
R/W ------- P2.1
E ------- p2.7
DB0-DB7 ----- P0.0 -- P0.7
CS1 ------- P2.3 ( Left panel control)
CS2 ------- P2.2 ( Right Panel control)
RST ------- 1.27k pull up to DVDD,reset button to DGND
Vout
LED+ ------- 6.7ohm pull up to DVDD
LED- ------- DGND

--------------------------------------------------------------------*/

/*----------------------------------------------------------------
InDirect Access Mode Port Address Define
----------------------------------------------------------------*/

#define CW_Add_L 0x08 // Left panel write command address
#define CR_Add_L 0x0A // Left panel Read status address for busy flag
#define DW_Add_L 0x09 // Left Panel write disp data address
#define DR_Add_L 0x0B // Left Panel read disp data address

#define CW_Add_R 0x04 // Right panel write command address
#define CR_Add_R 0x06 // Right panel Read status address for busy flag
#define DW_Add_R 0x05 // Right Panel write disp data address
#define DR_Add_R 0x07 // Right Panel read disp data address

void Delay_us(int time)
{
int i;
for (i=0;i<time;i++);
}
void ToggleLed(void)
{
Delay_us(2000);
P3 ^= 0x10; // toggle led on/off state

}
void LatchIt(void) // for Write only
{
Delay_us(1);
P2 |= 0x80; // E = 1;
Delay_us(1);
P2 &= 0x7F; // E = 0; fall edge to strobe the data

}
unsigned char LeftIsBusy (void)
{
/* char xdata *Addr;
Addr = CR_Add_L;
if(( *Addr)&0x80)
return (1);
else
return (0);
*/
unsigned char ch= 0xff;
P2 = CR_Add_L;
Delay_us(1);
P2 |= 0x80; // E = 1;
ch = P0; // Read Data from bus immediately after E set to 1;
Delay_us(1);
P2 &= 0x7F; // E = 0; fall edge to stobe
if(ch&0x80)
return (1);
else
return (0);


}

unsigned char RightIsBusy(void)
{
/* char xdata *Addr;
Addr = CR_Add_R;
if(( *Addr)&0x80)
return (1);
else
return (0);
*/
unsigned char ch= 0xff;
P2 = CR_Add_R;
Delay_us(1);
P2 |= 0x80; // E = 1;
ch = P0; // Read Data from bus immediately after E set to 1;
Delay_us(1);
P2 &= 0x7F; // E = 0; fall edge to strobe
if(ch&0x80)
return (1);
else
return (0);

}

void LeftWriteCommand(char command)
{
/* char xdata *Addr;
Addr = CW_Add_L;
while(LeftIsBusy());
*Addr = command;
*/
while(LeftIsBusy());
P2 = CW_Add_L;
P0 = command;
LatchIt();

}

void RightWriteCommand(char command)
{
/* char xdata *Addr;
Addr = CW_Add_R;
while(RightIsBusy());
*Addr = command;
*/
while(RightIsBusy());
P2 = CW_Add_R;
P0 = command;
LatchIt();

}

void LeftWriteData(char Disp)
{
/*
char xdata *Addr;
Addr = DW_Add_L;
while(LeftIsBusy());
*Addr = Disp;
*/
while(LeftIsBusy());
P2 = DW_Add_L;
P0 = Disp;
LatchIt();

}

void RightWriteData(char Disp)
{
/* char xdata *Addr;
Addr = DW_Add_R;
while(RightIsBusy());
*Addr = Disp;
*/
while(RightIsBusy());
P2 = DW_Add_R;
P0 = Disp;
LatchIt();

}
void CLR_Screen(void)
{
unsigned char i,j,k;
i=0;
while(i<8)
{

k=i;
LeftWriteCommand(k|0x0b8);
RightWriteCommand(k|0x0b8);
LeftWriteCommand(0x40);
RightWriteCommand(0x40);
j=0;
while(j<64)
{
LeftWriteData(0x00);
RightWriteData(0x00);
j+=1;
};

i+=1;
}


}
void InitLCD(void)
{

LeftWriteCommand(0x0c0);
RightWriteCommand(0x0c0);
LeftWriteCommand(0x40);
RightWriteCommand(0x40);
LeftWriteCommand(0x0b8);
RightWriteCommand(0x0b8);
LeftWriteCommand(0x3f);
RightWriteCommand(0x3f);

CLR_Screen();

}

void Main(void)
{
unsigned char i;
// ToggleLed();
unsigned char disp[7]={0x00,0x0fe,0x10,0x10,0x10,0x0fe,0x00};
InitLCD();
LeftWriteCommand(0x0c0);
RightWriteCommand(0x0c0);
LeftWriteCommand(0x40);
RightWriteCommand(0x40);
LeftWriteCommand(0x0b8);
RightWriteCommand(0x0b8);
LeftWriteCommand(0x3f);
RightWriteCommand(0x3f);


i=0;
while(i<7){
LeftWriteData(disp[i]); // display "H" on the screen
RightWriteData(disp[i]);
i+=1;
}
ToggleLed();

}


--
Li Jin


List of 5 messages in thread
TopicAuthorDate
help using LCD module problem!            01/01/70 00:00      
RE: help using LCD module problem!            01/01/70 00:00      
RE: help using LCD module problem!            01/01/70 00:00      
RE: help using LCD module problem!            01/01/70 00:00      
RE: help using LCD module problem!            01/01/70 00:00      

Back to Subject List