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

GLCD Problem

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







GLCD Problem
PostPosted: Wed Mar 28, 2007 2:56 am     Reply with quote

I am a newbie to CCS and i hae some problem with GLCD. i connected adc to pic and lcd displays the result. problem is when an adc value changes the location in the lcd where the vlue displays is getting filled. when i reset pic the changed value appear n once te value changes the location get filled(pixeled)

i am using pic 16f877a with 8MHz external clk.

Code:

#include "C:\picc\glcd_877.h"
#include "C:\Program Files\PICC\Drivers\GLCD.C"

char mystring[20];
char  voltText[] = "Voltage:",Text1[] = "Mariyam sh",ds[] = "ahyma";
long adc;

void main()
{
   setup_adc_ports(RA0_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   set_adc_channel(0);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_timer_0(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);
   glcd_init(on);
   //delay_ms(2000);

   // TODO: USER CODE!!
while(1)
{
//glcd_init(on);
//glcd_fillScreen(off);
adc = read_adc();
sprintf(mystring,"%f", (float)adc* .01960784);
glcd_text57(68, 5, voltText, 1, ON);
glcd_text57(0, 5, mystring, 1, ON);
glcd_text57(68, 20, Text1, 1, ON);
glcd_text57(0, 20, ds, 1, ON);
//delay_us(1);

};
}


THIS IS THE CORRECT ONE
AFZAL
Guest







PostPosted: Wed Mar 28, 2007 6:45 am     Reply with quote

is anyone gona answer me for this
forbiddenhex



Joined: 21 Mar 2007
Posts: 3

View user's profile Send private message

GLCD Problem
PostPosted: Wed Mar 28, 2007 9:32 am     Reply with quote

finally registered...

http://farm1.static.flickr.com/149/437646576_2e5cba89b4_m.jpg
http://farm1.static.flickr.com/145/437649183_b33c805e81_m.jpg

see these two links for whats actually happened. so find me a solution.
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 28, 2007 4:42 pm     Reply with quote

A LCD driver IC dose not clear the dIsplay before it write new data, so what you are seen is more data been overwritten over the old. You need to clear the area you are tring to write to before you send it more data
Guest








PostPosted: Wed Mar 28, 2007 9:14 pm     Reply with quote

I used glcd_fillScreen(off); when i use this its ok. but little fliker on that area.

Code:

#include "C:\picc\glcd_877.h"
#include "C:\Program Files\PICC\Drivers\GLCD.C"

char mystring[20];
char  voltText[] = "Voltage:",Text1[] = "Mariyam sh",ds[] = "ahyma";
long adc;

void main()
{
   setup_adc_ports(RA0_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   set_adc_channel(0);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_timer_0(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);
   glcd_init(on);
   //delay_ms(2000);

   // TODO: USER CODE!!
while(1)
{


adc = read_adc();
sprintf(mystring,"%f", (float)adc* .01960784);
glcd_text57(68, 5, voltText, 1, ON);
glcd_text57(0, 5, mystring, 1, ON);
glcd_text57(68, 20, Text1, 1, ON);
glcd_text57(0, 20, ds, 1, ON);
//glcd_fillScreen(off);


};
}

is there any other way. Please give some more idea.[/code]
forbiddenhex



Joined: 21 Mar 2007
Posts: 3

View user's profile Send private message

PostPosted: Wed Mar 28, 2007 9:17 pm     Reply with quote

I used glcd_fillScreen(off); when i use this its ok. but little fliker on that area.

Code:

#include "C:\picc\glcd_877.h"
#include "C:\Program Files\PICC\Drivers\GLCD.C"

char mystring[20];
char voltText[] = "Voltage:",Text1[] = "Mariyam sh",ds[] = "ahyma";
long adc;

void main()
{
setup_adc_ports(RA0_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
set_adc_channel(0);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(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);
glcd_init(on);
//delay_ms(2000);

// TODO: USER CODE!!
while(1)
{


adc = read_adc();
sprintf(mystring,"%f", (float)adc* .01960784);
glcd_text57(68, 5, voltText, 1, ON);
glcd_text57(0, 5, mystring, 1, ON);
glcd_text57(68, 20, Text1, 1, ON);
glcd_text57(0, 20, ds, 1, ON);
glcd_fillScreen(off);


};
}

is there any other way. Please give some more idea.[/code]
forbiddenhex



Joined: 21 Mar 2007
Posts: 3

View user's profile Send private message

PostPosted: Thu Mar 29, 2007 5:58 am     Reply with quote

Code:

#include "C:\picc\glcd_877.h"
#include "C:\Program Files\PICC\Drivers\GLCD.C"


char mystring[20], voltText[] = "Voltage:",Text1[] = "Forbiddenhex",Texts[] = "http://pixelatedpic.blogspot.com";
long adc;

void main()
{
   setup_adc_ports(RA0_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   set_adc_channel(0);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_timer_0(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);
   glcd_init(on);
   // TODO: USER CODE!!
   
do
{
adc = read_adc();
sprintf(mystring,"%f", (float)adc* .01960784);
glcd_text57(0, 5, voltText, 1, ON);
glcd_text57(50, 5, mystring, 1, ON);
glcd_text57(0, 20, Text1, 1, ON);
glcd_text57(0, 30, Texts, 1, ON);
glcd_text57(25,54, Text1, 1, ON);
glcd_text57(50, 5, mystring, 1, OFF);
}while(true);
}


I modified my code like this. Now the flikering is in the area where the mysting is displayed. Is anyone have any better ideas let me know. I think if i invert the fonts the filling effect will be gone..hope for an answer....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 29, 2007 12:01 pm     Reply with quote

Markdem gave you the basic idea.

The problem is caused by the glcd_text57() function. If look at the
code for that routine, you'll see that it writes pixels in a character by
calling the glcd_pixel() routine. But it only writes the pixels that are
"on" in a particular character. It doesn't write the "off" pixels. That's
the problem. That's why you're getting the "Fill-in" effect.
In other words, CCS is using Transparent mode to write the text.
They apparently don't have an option for Opaque mode.

It's possible that you could modify the glcd_text57() code to write
in Opaque mode. But the speed might be too slow. You would
have to test it.
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