Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CodeVision AVR 1.25.7, user manual.pdf
Скачиваний:
232
Добавлен:
12.08.2013
Размер:
1.22 Mб
Скачать

CodeVisionAVR

5.2 Setting the External SRAM

For the AVR chips that allow connection of external SRAM, you can specify the size of this memory and wait state insertion by selecting the External SRAM tab.

The size of external SRAM can be specified using the External SRAM Size list box.

Additional wait states in accessing the external SRAM can be inserted by checking the External SRAM Wait State check box.

The MCUCR register in the startup initialization code is configured automatically according to these settings.

© 1998-2007 HP InfoTech S.R.L.

Page 182

CodeVisionAVR

For devices, like the ATmega161, that allow splitting the external SRAM in two pages, the External SRAM configuration window will look like this:

The External SRAM page configuration list box allows selection of the splitting address for the two external SRAM pages .

The wait states that are inserted during external SRAM access, can be specified for the lower, respectively upper, memory pages using the Lower wait states, respectively Upper wait states list boxes.

The MCUCR and EMCUCR registers in the startup initialization code are configured automatically according to these settings.

© 1998-2007 HP InfoTech S.R.L.

Page 183

CodeVisionAVR

5.3 Setting the Input/Output Ports

By selecting the Ports tab of the CodeWizardAVR, you can specify the input/output Ports configuration.

You can chose which port you want to configure by selecting the appropriate PORT x tab.

By clicking on the corresponding Data Direction bit you can set the chip pin to be output (Out) or input (In).

The DDRx register will be initialized according to these settings.

By clicking on the corresponding Pullup/Output Value bit you can set the following options:

if the pin is an input, it can be tri-stated (T) or have an internal pull-up (P) resistor connected to the positive power supply.

if the pin is an output, it's value can be initially set to 0 or 1.

The PORTx register will be initialized according to these settings.

© 1998-2007 HP InfoTech S.R.L.

Page 184

CodeVisionAVR

5.4 Setting the External Interrupts

By selecting the External IRQ tab of the CodeWizardAVR, you can specify the external interrupt configuration.

Checking the appropriate INTx Enabled check box enables the corresponding external interrupt.

If the AVR chip supports this feature, you can select if the interrupt will be edge or level triggered using the corresponding Mode list box.

For each enabled external interrupt the CodeWizardAVR will define an ext_intx_isr interrupt service routine, where x is the number of the external interrupt.

© 1998-2007 HP InfoTech S.R.L.

Page 185

CodeVisionAVR

For some devices, like the Atmega169V/L, the External IRQ tab may present the following options:

The Pin Change Interrupt Enable check boxes, if checked, will specify which of the PCINT I/O pins will trigger an external interrupt.

The interrupt service routines for these interrupts will be pin_change_isr0 for PCINT0-7 and pin_change_isr1 for PCINT8-15.

© 1998-2007 HP InfoTech S.R.L.

Page 186