|
|
View previous topic :: View next topic |
Author |
Message |
AFZAL Guest
|
GLCD Problem |
Posted: Wed Mar 28, 2007 2:56 am |
|
|
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
|
|
Posted: Wed Mar 28, 2007 6:45 am |
|
|
is anyone gona answer me for this |
|
|
forbiddenhex
Joined: 21 Mar 2007 Posts: 3
|
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Wed Mar 28, 2007 4:42 pm |
|
|
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
|
|
Posted: Wed Mar 28, 2007 9:14 pm |
|
|
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
|
|
Posted: Wed Mar 28, 2007 9:17 pm |
|
|
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
|
|
Posted: Thu Mar 29, 2007 5:58 am |
|
|
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
|
|
Posted: Thu Mar 29, 2007 12:01 pm |
|
|
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. |
|
|
|
|
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
|