Forum: Mikrocontroller und Digitale Elektronik AT91SAM7X256-EK Hardware I2C Display Probleme


von Pepade (Gast)


Lesenswert?

Hallo,

ich will vom AT91SAM7X256-EK die Hardware I2C verwenden. Aber wenn ich 
es zyklisch beschreibe um eine Laufschrift/ einen Ticker zu realisieren, 
dann  funktioniert das groeßten Teils einwandfrei. Doch dann faengt das 
Display an zu flackern und die Schrift an anderen Stellen loest sich 
langsam auf. Ich hab schon die Frequenzen variiert(50-95kHz). Der 
Display Controller ist ein Philips PCF8558 mit 96*40 Dots. Bei einem 
rein statischen Text ist alles wunderbar. Der Fehler tritt sogar auf, 
wenn ich einen statischen Text ganz oft an die selbe Stelle 
schreibe...Ich hoffe, ich habe nichts veregssen :)

Hier einmal die GLCD Routinen, vielleicht hab ich ja etwas uebersehen. 
Vielen Dank fuer eure hilfe schon einmal...

Initialisierung:
1
void initDisplay(){
2
//...
3
AT91PS_AIC pAic;
4
5
  /* Load System pAic Base address */
6
  pAic = AT91C_BASE_AIC;
7
8
  /* Enable User Reset and set its minimal assertion to 960 us */
9
  AT91C_BASE_RSTC->RSTC_RMR = AT91C_RSTC_URSTEN | (0x4<<8) | (unsigned int)(0xA5<<24);
10
11
  /* TWI intialization @ TWI_BUS_CLOCK for all TWI devices connected on the bus */
12
  AT91F_TWI_Open(TWI_BUS_CLOCK);
13
  /* First, enable the clock of the PIOA */
14
  AT91C_BASE_PMC->PMC_PCER = ( (U32) 1 << AT91C_ID_PIOA);
15
16
//...
17
18
}
1
/*-----------------------------------------------------------------------------
2
 This Function writes one charactere in a lcd page (LcdPage) and at the specific
3
 column address (X_Address).
4
 This function uses the TWI in Master write mode with multiple data.
5
-----------------------------------------------------------------------------*/
6
void AT91F_Glcd_PutChar(unsigned char c,
7
                        unsigned char LcdPage,
8
                        unsigned char X_Address)
9
{
10
   int i;
11
   unsigned int status;
12
13
   /* Enable Master Mode of the TWI */
14
    AT91C_BASE_TWI->TWI_CR = AT91C_TWI_MSEN ;
15
16
    /* Set the TWI Master Mode Register */
17
    AT91C_BASE_TWI->TWI_MMR =  AT91C_GLCD_I2C_ADDRESS & ~AT91C_TWI_MREAD;
18
19
    /* Send the command + the Page Address */
20
    AT91C_BASE_TWI->TWI_THR = Normal+LcdPage;
21
22
    /* Wait until TXRDY is high to transmit the next data */
23
    status = AT91C_BASE_TWI->TWI_SR;
24
       while (!(status & AT91C_TWI_TXRDY))
25
        status = AT91C_BASE_TWI->TWI_SR;
26
27
      /* Send X address (column address) */
28
      AT91C_BASE_TWI->TWI_THR = X_START+X_Address;
29
30
   /* Send bit to display a character by using the charset table */
31
   for ( i=0; i<5; i++ )
32
   {
33
     /* Wait for the Transmit ready is set to send the next data */
34
     status = AT91C_BASE_TWI->TWI_SR;
35
      while (!(status & AT91C_TWI_TXRDY))
36
        status = AT91C_BASE_TWI->TWI_SR;
37
     /* Send the data to turn on the right pixels to display the character */
38
     AT91C_BASE_TWI->TWI_THR = charset[(c-32)][i];
39
   }
40
41
42
   /* Wait for the Transmit complete is set */
43
   status = AT91C_BASE_TWI->TWI_SR;
44
   while (!(status & AT91C_TWI_TXCOMP))
45
     status = AT91C_BASE_TWI->TWI_SR;
46
47
}

Gruß

Pepade

von Pepade (Gast)


Lesenswert?

danke fuer die antworten ;)

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.