Rainbow-electronics ATmega8515L Manuel d'utilisateur Page 30

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 223
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 29
30
ATmega8515(L)
2512A–AVR–04/02
Using all 64KB Locations of
External Memory
Sincethe ExternalMemory is mapped after the InternalMemory asshowninFigure11,
only 60KB ofExternalMemory is available by default (address space0x0000 to 0x025F
isreservedforInternalMemory). However, it ispossibletotakeadvantage of the entire
ExternalMemory by masking the higher address bits to zero. Thiscan be done by using
the XMMn bits andcontrolbysoftwarethemost significant bits of theaddress. By set-
ting Port C to output 0x00, andreleasing themost significant bitsfor normal PortPin
operation, the Memory Interface will address 0x0000 - 0x1FFF. See codeexample
below.
Note: 1. Theexample codeassumes that the part specificheaderfileis included.
Caremust beexercised using this option as mostof thememory is masked away.
Assembly Code Example
(1)
; OFFSET is defined to 0x2000 to ensure
; external memory access
; Configure Port C (address high byte) to
; output 0x00 when the pins are released
; for normal Port Pin operation
ldi r16, 0xFF
out DDRC, r16
ldi r16, 0x00
out PORTC, r16
; release PC7:5
ldi r16, (1<<XMM1)|(1<<XMM0)
out SFIOR, r16
; write 0xAA to address 0x0001 of external
; memory
ldi r16, 0xaa
sts 0x0001+OFFSET, r16
; re-enable PC7:5 for external memory
ldi r16, (0<<XMM1)|(0<<XMM0)
out SFIOR, r16
; store 0x55 to address (OFFSET + 1) of
; external memory
ldi r16, 0x55
sts 0x0001+OFFSET, r16
CCode Example
(1)
#define OFFSET 0x2000
void XRAM_example(void)
{
unsigned char *p = (unsigned char *) (OFFSET + 1);
DDRC = 0xFF;
PORTC = 0x00;
SFIOR = (1<<XMM1) | (1<<XMM0);
*p = 0xaa;
SFIOR = 0x00;
*p = 0x55;
}
Vue de la page 29
1 2 ... 25 26 27 28 29 30 31 32 33 34 35 ... 222 223

Commentaires sur ces manuels

Pas de commentaire