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 support@ccsinfo.com

blinking lcd display

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



Joined: 10 Feb 2006
Posts: 6

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

blinking lcd display
PostPosted: Wed Feb 22, 2006 3:38 pm     Reply with quote

I use a pic18f4455. My display (BLG1206A1YSR with HD61202U chipset) and some sensors are on the on the PortB, so I use an adress decoder...

My problem is that I have to reinitialize the display each time I want to print the value from the ADC... by the way, the display is blinking each time a value is printed on. What can I do to remove the blinking. If I dont initialize the display nothing appear on the display.

this is my code:
void main()
{
// Valeur lue.
int16 adc;

// Température via port série.
float Valeur;
// Titre pour la température
char TemperatureText[] = "Temp:";

// C'est la premiere initialisation de l'écran.
PremiereInitialisation = VRAI;


//----------------------------------------------------------------------
// Décodeur d'adresse
//----------------------------------------------------------------------

// Port E en sortie.
set_tris_e(0x00);
// Mettre le Port E au niveau haut (111) pour
// choisir l'afficheur.
output_high(PIN_E0);
output_high(PIN_E1);
output_high(PIN_E2);

// Port B en sortie (Pour l'afficheur).
set_tris_b(0x00);

//----------------------------------------------------------------------
// Configuration pour l'analogique
//----------------------------------------------------------------------

// Ne plus utiliser l'analogique.
setup_adc_ports(NO_ANALOGS);

//----------------------------------------------------------------------
// Affichage de la température sur l'afficheur graphique LCD
//----------------------------------------------------------------------

// Initialiser l'afficheur.
glcd_init(ON);

// Afficher le titre pour la température.
glcd_text57(10, 18, TemperatureText, 1, ON);


//----------------------------------------------------------------------
// Mise à jour de l'afficheur graphique LCD
//----------------------------------------------------------------------

#ifdef FAST_GLCD
glcd_update();
#else
// Reduces flicker by allowing pixels to be on
// much longer than off
delay_ms(100);
#endif

do
{
//----------------------------------------------------------------------
// Configuration pour l'analogique
//----------------------------------------------------------------------

// Référence + à 1V.
setup_adc_ports(ALL_ANALOG|VSS_VREF);
// Clock interne.
setup_adc(ADC_CLOCK_INTERNAL);
// Analogue 12 (B0 - LM35D).
set_adc_channel(12);

//----------------------------------------------------------------------
// Décodeur d'adresse
//----------------------------------------------------------------------

// Mettre le Port E au niveau bas (000) pour
// choisir les capteurs
output_low(PIN_E0);
output_low(PIN_E1);
output_low(PIN_E2);

// Port B en entrée (Pour lecture des capteurs).
set_tris_b(0xFF);

//----------------------------------------------------------------------
// Lecture de la valeur analogique / Affichage sur PC de la valeur numérique
//----------------------------------------------------------------------

// Attendre 1000ms.
delay_ms(1000);
// Lire la valeur du capteur de température.
adc = Read_ADC();

Valeur = (float)adc / 10.24;
// Afficher la température lue via port série.
printf("\n\rTempérature ambiante: %f\n\r",Valeur);


//----------------------------------------------------------------------
// Décodeur d'adresse
//----------------------------------------------------------------------

// Mettre le Port E au niveau haut (111) pour
// choisir l'afficheur
output_high(PIN_E0);
output_high(PIN_E1);
output_high(PIN_E2);

// Port B en sortie (Pour l'afficheur).
set_tris_b(0x00);

//----------------------------------------------------------------------
// Configuration pour l'analogique
//----------------------------------------------------------------------

// Ne plus utiliser l'analogique.
setup_adc_ports(NO_ANALOGS);

//----------------------------------------------------------------------
// Affichage de la température sur l'afficheur graphique LCD
//----------------------------------------------------------------------

// Initialiser l'afficheur.
glcd_init(ON); (I dont know why i have to do this again here)

// Afficher la température.
displayVoltage(adc);
adc++;
//----------------------------------------------------------------------
// Mise à jour de l'afficheur graphique LCD
//----------------------------------------------------------------------
#ifdef FAST_GLCD
glcd_update();
#else
// Reduces flicker by allowing pixels to be on
// much longer than off
delay_ms(100);
#endif

}
// Tant qu'il y a de l'alimentation.
while (TRUE);
}
javi.ar



Joined: 17 Feb 2006
Posts: 59
Location: Argentina

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

Re: blinking lcd display
PostPosted: Thu Feb 23, 2006 1:44 pm     Reply with quote

DriverInside wrote:
I use a pic18f4455. My display (BLG1206A1YSR with HD61202U chipset) and some sensors are on the on the PortB, so I use an adress decoder...

My problem is that I have to reinitialize the display each time I want to print the value from the ADC... by the way, the display is blinking each time a value is printed on. What can I do to remove the blinking. If I dont initialize the display nothing appear on the display.

this is my code:
void main()
{
// Valeur lue.
int16 adc;

// Température via port série.
float Valeur;
// Titre pour la température
char TemperatureText[] = "Temp:";

// C'est la premiere initialisation de l'écran.
PremiereInitialisation = VRAI;


//----------------------------------------------------------------------
// Décodeur d'adresse
//----------------------------------------------------------------------

// Port E en sortie.
set_tris_e(0x00);
// Mettre le Port E au niveau haut (111) pour
// choisir l'afficheur.
output_high(PIN_E0);
output_high(PIN_E1);
output_high(PIN_E2);

// Port B en sortie (Pour l'afficheur).
set_tris_b(0x00);

//----------------------------------------------------------------------
// Configuration pour l'analogique
//----------------------------------------------------------------------

// Ne plus utiliser l'analogique.
setup_adc_ports(NO_ANALOGS);

//----------------------------------------------------------------------
// Affichage de la température sur l'afficheur graphique LCD
//----------------------------------------------------------------------

// Initialiser l'afficheur.
glcd_init(ON);

// Afficher le titre pour la température.
glcd_text57(10, 18, TemperatureText, 1, ON);


//----------------------------------------------------------------------
// Mise à jour de l'afficheur graphique LCD
//----------------------------------------------------------------------

#ifdef FAST_GLCD
glcd_update();
#else
// Reduces flicker by allowing pixels to be on
// much longer than off
delay_ms(100);
#endif

do
{
//----------------------------------------------------------------------
// Configuration pour l'analogique
//----------------------------------------------------------------------

// Référence + à 1V.
setup_adc_ports(ALL_ANALOG|VSS_VREF);
// Clock interne.
setup_adc(ADC_CLOCK_INTERNAL);
// Analogue 12 (B0 - LM35D).
set_adc_channel(12);

//----------------------------------------------------------------------
// Décodeur d'adresse
//----------------------------------------------------------------------

// Mettre le Port E au niveau bas (000) pour
// choisir les capteurs
output_low(PIN_E0);
output_low(PIN_E1);
output_low(PIN_E2);

// Port B en entrée (Pour lecture des capteurs).
set_tris_b(0xFF);

//----------------------------------------------------------------------
// Lecture de la valeur analogique / Affichage sur PC de la valeur numérique
//----------------------------------------------------------------------

// Attendre 1000ms.
delay_ms(1000);
// Lire la valeur du capteur de température.
adc = Read_ADC();

Valeur = (float)adc / 10.24;
// Afficher la température lue via port série.
printf("\n\rTempérature ambiante: %f\n\r",Valeur);


//----------------------------------------------------------------------
// Décodeur d'adresse
//----------------------------------------------------------------------

// Mettre le Port E au niveau haut (111) pour
// choisir l'afficheur
output_high(PIN_E0);
output_high(PIN_E1);
output_high(PIN_E2);

// Port B en sortie (Pour l'afficheur).
set_tris_b(0x00);

//----------------------------------------------------------------------
// Configuration pour l'analogique
//----------------------------------------------------------------------

// Ne plus utiliser l'analogique.
setup_adc_ports(NO_ANALOGS);

//----------------------------------------------------------------------
// Affichage de la température sur l'afficheur graphique LCD
//----------------------------------------------------------------------

// Initialiser l'afficheur.
glcd_init(ON); (I dont know why i have to do this again here)

// Afficher la température.
displayVoltage(adc);
adc++;
//----------------------------------------------------------------------
// Mise à jour de l'afficheur graphique LCD
//----------------------------------------------------------------------
#ifdef FAST_GLCD
glcd_update();
#else
// Reduces flicker by allowing pixels to be on
// much longer than off
delay_ms(100);
#endif

}
// Tant qu'il y a de l'alimentation.
while (TRUE);
}


I wont go through the whole code, but I fixed this just only updated the required changing date i.e. LCD OUTPUT => Hello 99
I just modify 99 with the lcd_gotoxy(7,0) with the new data, no more anoying flickering ... Hope this help, otherwise let me know I could either give my code or review yours... ok? Regards from Buenos Aires..
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