Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
9
Добавлен:
21.12.2020
Размер:
8.16 Mб
Скачать

PIC18F8722 FAMILY

7.4Program Memory Modes and the External Memory Bus

PIC18F8527/8622/8627/8722 devices are capable of operating in any one of four program memory modes, using combinations of on-chip and external program memory. The functions of the multiplexed port pins depends on the program memory mode selected, as well as the setting of the EBDIS bit.

In Microcontroller Mode, the bus is not active and the pins have their port functions only. Writes to the MEMCOM register are not permitted. The Reset value of EBDIS (‘0’) is ignored and EMB pins behave as I/O ports.

In Microprocessor Mode, the external bus is always active and the port pins have only the external bus function. The value of EBDIS is ignored.

In Microprocessor with Boot Block or Extended Microcontroller Mode, the external program memory bus shares I/O port functions on the pins. When the device is fetching or doing table read/table write operations on the external program memory space, the pins will have the external bus function. If the device is fetching and accessing internal program memory locations only, the EBDIS control bit will change the pins from external memory to I/O port functions. When EBDIS = 0, the pins function as the external bus. When EBDIS = 1, the pins function as I/O ports.

If the device fetches or accesses external memory while EBDIS = 1, the pins will switch from I/O to external bus. If the EBDIS bit is set by a program executing from external memory, the action of setting the bit will be delayed until the program branches into the internal memory. At that time, the pins will change from external bus to I/O ports.

If the device is executing out of internal memory when EBDIS = 0, the memory bus address/data and control pins will not be active. They will go to a state where the active address/data pins are tri-state; the CE, OE, WRH, WRL, UB and LB signals are ‘1’; and ALE and BA0 are ‘0’. Note that only those pins associated with the current address width are forced to tri-state; the other pins continue to function as I/O. In the case of 16-bit address width, for example, only AD<15:0> (PORTD and PORTE) are affected; A<19:16> (PORTH<3:0>) continue to function as I/O.

In all external memory modes, the bus takes priority over any other peripherals that may share pins with it. This includes the Parallel Slave Port and serial communications modules which would otherwise take priority over the I/O port.

7.516-bit Data Width Modes

In 16-bit Data Width mode, the external memory bus can be connected to external memories in three different configurations:

16-bit Byte Write

16-bit Word Write

16-bit Byte Select

The configuration to be used is determined by the WM1:WM0 bits in the MEMCON register (MEMCON<1:0>). These three different configurations allow the designer maximum flexibility in using both 8-bit and 16-bit devices with 16-bit data.

For all 16-bit modes, the Address Latch Enable (ALE) pin indicates that the address bits AD<15:0> are available on the external memory interface bus. Following the address latch, the Output Enable signal (OE) will enable both bytes of program memory at once to form a 16-bit instruction word. The Chip Enable signal (CE) is active at any time that the microcontroller accesses external memory, whether reading or writing; it is inactive (asserted high) whenever the device is in Sleep mode.

In Byte Select mode, JEDEC standard Flash memories will require BA0 for the byte address line and one I/O line to select between Byte and Word mode. The other 16-bit modes do not need BA0. JEDEC standard static RAM memories will use the UB or LB signals for byte selection.

DS39646B-page 100

Preliminary

2004 Microchip Technology Inc.

PIC18F8722 FAMILY

7.5.116-BIT BYTE WRITE MODE

Figure 7-1 shows an example of 16-bit Byte Write mode for PIC18F8527/8622/8627/8722 devices. This mode is used for two separate 8-bit memories connected for 16-bit operation. This generally includes basic EPROM and Flash devices. It allows table writes to byte-wide external memories.

During a TBLWT instruction cycle, the TABLAT data is presented on the upper and lower bytes of the AD15:AD0 bus. The appropriate WRH or WRL control line is strobed on the LSb of the TBLPTR.

FIGURE 7-1: 16-BIT BYTE WRITE MODE EXAMPLE

 

 

D<7:0>

 

 

 

PIC18F8X27/8X22

 

(MSB)

(LSB)

AD<7:0>

373

A<19:0>

 

A<x:0>

A<x:0>

 

 

 

 

D<15:8>

 

D<7:0>

 

 

 

D<7:0>

D<7:0>

 

 

CE

 

CE

 

AD<15:8>

373

OE

WR(2)

OE

WR(2)

ALE

 

 

 

 

 

A<19:16>(1)

 

 

 

 

 

CE

 

 

 

 

 

OE

 

 

 

 

 

WRH

 

 

 

 

 

WRL

 

 

 

 

 

 

 

 

Address Bus

 

 

 

 

Data Bus

 

 

 

 

 

Control Lines

 

Note 1: Upper-order address lines are used only for 20-bit address widths.

2:This signal only applies to table writes. See Section 6.1 “Table Reads and Table Writes”.

2004 Microchip Technology Inc.

Preliminary

DS39646B-page 101

PIC18F8722 FAMILY

7.5.216-BIT WORD WRITE MODE

Figure 7-2 shows an example of 16-bit Word Write mode for PIC18F8527/8622/8627/8722 devices. This mode is used for word-wide memories which includes some of the EPROM and Flash-type memories. This mode allows opcode fetches and table reads from all forms of 16-bit memory and table writes to any type of word-wide external memories. This method makes a distinction between TBLWT cycles to even or odd addresses.

During a TBLWT cycle to an even address (TBLPTR<0> = 0), the TABLAT data is transferred to a holding latch and the external address data bus is tri-stated for the data portion of the bus cycle. No write signals are activated.

During a TBLWT cycle to an odd address (TBLPTR<0> = 1), the TABLAT data is presented on the upper byte of the AD15:AD0 bus. The contents of the holding latch are presented on the lower byte of the AD15:AD0 bus.

The WRH signal is strobed for each write cycle; the WRL pin is unused. The signal on the BA0 pin indicates the Least Significant bit of TBLPTR but it is left unconnected. Instead, the UB and LB signals are active to select both bytes. The obvious limitation to this method is that the table write must be done in pairs on a specific word boundary to correctly write a word location.

FIGURE 7-2: 16-BIT WORD WRITE MODE EXAMPLE

PIC18F8X27/8X22

 

A<20:1>

 

 

 

AD<7:0>

373

A<x:0>

JEDEC Word

 

 

 

 

 

EPROM Memory

 

 

D<15:0>

D<15:0>

 

 

 

 

 

 

 

AD<15:8>

 

 

CE

OE

WR(2)

373

 

 

 

 

 

 

 

 

 

ALE

 

 

 

 

 

A<19:16>(1)

 

 

 

 

 

CE

 

 

 

 

 

OE

 

 

 

 

 

WRH

 

 

 

 

 

Address Bus

Data Bus

Control Lines

Note 1: Upper-order address lines are used only for 20-bit address widths.

2:This signal only applies to table writes. See Section 6.1 “Table Reads and Table Writes”.

DS39646B-page 102

Preliminary

2004 Microchip Technology Inc.

PIC18F8722 FAMILY

7.5.316-BIT BYTE SELECT MODE

Figure 7-3 shows an example of 16-bit Byte Select mode. This mode allows table write operations to word-wide external memories with byte selection capability. This generally includes both word-wide Flash and SRAM devices.

During a TBLWT cycle, the TABLAT data is presented on the upper and lower byte of the AD15:AD0 bus. The WRH signal is strobed for each write cycle; the WRL pin is not used. The BA0 or UB/LB signals are used to select the byte to be written, based on the Least Significant bit of the TBLPTR register.

Flash and SRAM devices use different control signal combinations to implement Byte Select mode. JEDEC standard Flash memories require that a controller I/O port pin be connected to the memory’s BYTE/WORD pin to provide the select signal. They also use the BA0 signal from the controller as a byte address. JEDEC standard static RAM memories, on the other hand, use the UB or LB signals to select the byte.

FIGURE 7-3:

16-BIT BYTE SELECT MODE EXAMPLE

 

 

 

PIC18F8X27/8X22

 

A<20:1>

 

 

 

AD<7:0>

373

A<x:1>

JEDEC Word

 

 

 

 

 

 

Flash Memory

 

 

 

 

 

D<15:0>

 

 

 

 

 

D<15:0>

AD<15:8>

373

138(3)

CE

 

 

 

 

A0

 

 

ALE

 

 

BYTE/WORD OE WR(1)

A<19:16>(2)

 

 

 

 

 

OE

 

 

 

 

 

WRH

 

 

 

 

 

WRL

 

A<20:1>

A<x:1>

JEDEC Word

 

 

 

BA0

 

 

 

 

SRAM Memory

I/O

 

 

 

 

D<15:0>

 

 

 

 

 

 

 

 

CE

 

D<15:0>

LB

 

 

LB

 

 

UB

 

 

UB

OE

WR(1)

 

 

 

 

 

Address Bus

 

 

 

 

 

Data Bus

 

 

 

 

 

Control Lines

Note 1: This signal only applies to table writes. See Section 6.1 “Table Reads and Table Writes”.

2:Upper-order address lines are used only for 20-bit address width.

3:Demultiplexing is only required when multiple memory devices are accessed.

2004 Microchip Technology Inc.

Preliminary

DS39646B-page 103

Соседние файлы в папке Склад