CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

how can set SEG1 COM3

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
WHUNG.JOHN
Guest







how can set SEG1 COM3
PostPosted: Wed Aug 01, 2007 10:59 am     Reply with quote

MY friends:
i think use ht1621 to control 32*4 LCD panel (32segs *4com)
i tried to writte program and still not display (seg1 com3) area .
can help me and tell me how to modify?
follow as:

#include <16F73.h>
#device adc=8
#FUSES NOWDT, XT, NOPUT, NOPROTECT, NOBROWNOUT
#use delay(clock=4000000)

#define DAT PIN_C7 // DT D0_74164 LCD DISPLAY
#define WR PIN_B0 //WR CLK_74164 LCD DISPLAY
#define cs pin_b1 //cs

#define bias 0x52
#define system 0x02
#define system_dis 0x00
#define lcdon 0x06
#define lcdoff 0x04
#define toneon 0x12
#define toneoff 0x10
#define test 0xc0
#define normal 0xc6
#define wdt1 0x0e


void sendbit_1621(unsigned char data,unsigned char cnt)
{
unsigned char i;

for (i=0;i<cnt;i++)
{
if ((data&0x80)==0) output_low(dAt);
else output_high(dAt);
output_low(wr);
//delay_ms(1);
output_high(wr);
data<<=1;

}
}

void senddatabit_1621(unsigned char data,unsigned char cnt)
{
unsigned char i;
for (i=0;i<cnt>>=1;


}
}

void lcd1621_init(void)
{

output_low(cs);

output_high(wr);
delay_ms(10);
output_low(wr);
delay_ms(10);
}


void sendcmd(unsigned char command)
{
lcd1621_init();
sendbit_1621(0x80,4);
sendbit_1621(command,8);
output_high(wr);
output_high(cs);
output_high(dat);

}


void write_1621(unsigned char addr,unsigned char data)
{
output_low(cs);
sendbit_1621(0xa0,3);
sendbit_1621(addr,6);
senddatabit_1621(data,4);
output_high(cs);
}

void writeall_1621(unsigned char addr,unsigned char *p,unsigned char cnt )
{
unsigned char i;
output_low(cs);
sendbit_1621(0xa0,3);
sendbit_1621(addr,6);
for (i=1;i<cnt;i++,p++)
{
senddatabit_1621(*p,8);
}
output_high(cs);
}


void write_74164(char eo)
{
unsigned int i;

for(i=1;i<=8;i++) { // Clock out bits from the eo array
if((((eo))& 0x80)==0)
output_low(DAT);
else
output_high(DAT);
shift_left(&eo,1,0);

output_low(WR);
output_high(WR);
}
}


void main()
{

unsigned char i,j;
sendcmd(wdt1);
sendcmd(bias);
sendcmd(system_dis);
sendcmd(system);
sendcmd(lcdoff);
sendcmd(lcdon);

write_1621(1,4); //get seg1 com3 area
while(1);
}
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Aug 03, 2007 7:02 am     Reply with quote

You might be clocking the driver too quickly, data sheet says 3.3uS minimum read pulse width and 1.7uS write pw.

Code:
void sendbit_1621(unsigned char data,unsigned char cnt)
{
unsigned char i;

for (i=0;i<cnt;i++)
{
if ((data&0x80)==0) output_low(dAt);
else output_high(dAt);
output_low(wr);
//delay_ms(1);
output_high(wr);
data<<=1;
}


Problem is between output_low(wr) and output_high(wr) - with nothing in between that will give you a pulse width of 1us. Put some NOPs in between them.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group