Bonjour
je suis en train de creer une petite librairie sous mcc18 pour la gestion d'un afficheur lcd.Voila mon probleme, j'ai reussi a afficher ma lettre mais elle ne reste pas en memoire.Voici mon programme:


[/CODE]
#include <p18f4520.h>
#include <delays.h>
int i;
typedef struct {
int RS:1;
int RW:1;
int E:1;
int Vide:1;
int data:4;
}lcd;


#pragma config OSC = HS // choisir le oscillateur HS



void lcd_init(void);
void lcd_clear(void);
int readflag(void);
void putc(char );
void puts(char *);
void Delay_TCY(int);
void placement(int,int);

#define lcd_ptr ((lcd *)(& PORTC))



void Delay_TCY(int n)
{ int i;
for(i=0;i<n;i++)
{
Delay1TCY();
}


}

void placement(int x,int y)
{


}

int readflag()
{ int HL;
TRISC=0xFF;
lcd_ptr->RS=0;
lcd_ptr->RW=1;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
HL=lcd_ptr->data;
lcd_ptr->E=0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
HL=HL<<4|lcd_ptr->data;
lcd_ptr->E=0;
TRISC=0x00;
return(HL);

}

void lcd_clear(void)
{
lcd_ptr->RS=0;

//EFFACER L'AFFICHEUR
lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

lcd_ptr->data=0x1;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;


}


void lcd_init(void)
{
TRISC =0x00;
PORTC=0b00;
ADCON1 |=0x0f; //toutes les canaux adc en i/o
ADCON0bits.ADON = 0; // adc module off
lcd_ptr->RS=0;

//EFFACER L'AFFICHEUR
lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

lcd_ptr->data=0x1;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

// //RETURN HOME
// lcd_ptr->data=0x0;
// lcd_ptr->E=1;
// Delay_TCY( 20 ); // Delay for 50TCY
// lcd_ptr->E=0;
// lcd_ptr->data=0x3;
// lcd_ptr->E=1;
// Delay_TCY( 20 ); // Delay for 50TCY
// lcd_ptr->E=0;
//

//SET DD RA ADRESSE
lcd_ptr->data=0x8;
lcd_ptr->E=1;
Delay_TCY( 20 ); // Delay for 50TCY
lcd_ptr->E=0;
lcd_ptr->data=0xF;
lcd_ptr->E=1;
Delay_TCY( 20 ); // Delay for 50TCY
lcd_ptr->E=0;



//METTRE L'AFFICHEUR EN 8bits
for(i=0;i<3;i++)
{
lcd_ptr->data=0x3;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;
}
//METTRE L4AFFICHEUR EN 4BITS
lcd_ptr->data=0x2;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;
//MODE 2 LIGNES
lcd_ptr->data=0x2;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;
lcd_ptr->data=0x8;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;


//CURSEUR
lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;
lcd_ptr->data=0xC;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;

//deplacement du curseur
lcd_ptr->data=0x0;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;
lcd_ptr->data=0x6;
lcd_ptr->E=1;
Delay_TCY( 5 ); // Delay for 50TCY
lcd_ptr->E=0;



}


void putc(char c)
{
while(readflag()>>7);
lcd_ptr->RS=1;
lcd_ptr->E=0;
lcd_ptr->RW=0;
lcd_ptr->data=0x6;
Delay_TCY( 1 );
lcd_ptr->E=1;
Delay_TCY( 20 ); // Delay for 50TCY
lcd_ptr->E=0;
lcd_ptr->data=0x6;
Delay_TCY( 1 );
lcd_ptr->E=1;
Delay_TCY( 20 ); // Delay for 50TCY
lcd_ptr->E=0;
lcd_ptr->RW=1;
}

void main(void) //20Mhz delay=200ns
{

lcd_init();



while(1)
{
putc("C");
}
//lcd_clear();

}

[/CODE]

D'avance merci