NEC ELECTRONICS GLOBAL
nec electronics global
HOME
APPLICATIONS
PRODUCTS
TECHNOLOGY
SUPPORT
BUY ONLINE
NEWS & EVENTS
ABOUT US
header
GO
AdvancedParametric
SITE MAP CONTACT US

Microcontroller and memory

Contents

    
FAQ-ID = mem-nnnn
0001: Microcontroller and memory
mem
-0001
Microcontroller and memory
[Introduction]
Usually, programs and data are stored in memory and the memory must always be accessed when the microcontroller operates.
The microcontroller reads the contents stored in memory or writes new contents to memory as necessary. Because a large number of programs and data are stored in memory, however, the necessary data cannot be obtained unless the subject, i.e., which contents of the memory, is correctly specified. Therefore, addresses are assigned to memories. Specifying an address allows the subject memory to be clearly specified. This is the same as a telephone network where a telephone number is assigned to each handset and, when a certain telephone number is dialed, connection with a specific handset is always established.



An 8-bit microcontroller such as those in the 78K0 Series has 8-bit registers, and therefore, usually handles data of 8 bits. The number of memory addresses that can be distinguished (specified) by 8 bits is 256. One address of memory is usually 8 bits (1 byte) long, so the size (capacity) of the memory is expressed in bytes. A memory of 256 addresses, i.e., 256 bytes, is not large enough to store a program. An 8-bit microcontroller therefore uses two registers to specify a memory in 16-bit units, so that up to 65536 bytes of memory can be used. An 8-bit microcontroller can therefore usually specify up to 65536 bytes of memory (because 65536 is a large number, an auxiliary unit k (kilo) is used to express 1024 bytes, which can be specified by 10 bits to express 216 bytes = 26 x 210 bytes = 64 x 1 KB = 64 KB).

Similarly, the number of bits of the major microcontroller is expressed as follows
12 bits: 212 bytes = 22 x 210 bytes = 4 x 1 KB = 4 KB
14 bits: 214 bytes = 24 x 210 bytes = 16 x 1 KB = 16 KB
15 bits: 215 bytes = 25 x 210 bytes = 32 x 1 KB = 32 KB
20 bits: 220 bytes = 210 x 210 bytes = 1024 x 1 KB = 1 MB
24 bits: 224 bytes = 24 x 220 bytes = 16 x 1 MB = 16 MB
30 bits: 230 bytes = 210 x 220 bytes = 1024 x 1 MB = 1 GB
32 bits: 232 bytes = 22 x 230 bytes = 4 x 1 GB = 4 GB

In almost all 8-bit microcontroller applications, there has been no problem as long as a memory of 64 KB is used. Actually, most of the products in the 78K0 and 78K0S Series have several KB to 32 KB, and the products that use a memory of more than 60 KB are limited. Some 8-bit microcontrollers, however, can specify data of up to 1 MB even if the program is 64 KB, because these microcontrollers are intended to handle a large amount of data such as font data. These microcontrollers are called 78K2 microcontrollers. However, they do not have an on-chip memory of more than 64 KB but can only handle an external memory of 1 MB. The recent 8-bit microcontrollers (78K0/Kx2) that can handle a memory of at least 64 KB internally have a memory itself.

In the 8080 generation microcontrollers, the very first 8-bit microcontrollers, an assembler operated by itself in a system equipped with 8 KB RAM. Incidentally, TK-80 did not have ROM and RAM having 1 KB each.
The first 8-bit single-chip microcontroller, the 8048, had a ROM of 1 KB and a RAM of 64 bytes (this means that only up to 4 KB of ROM and 2256 bytes of RAM could be used).
In these generations, 64 KB seemed a far off boundary farther away. The 8-bit microcontroller of today has exceeded this boundary.

[Accessing memory]
Two things must be considered when specifying a memory address when a microcontroller uses memory. One is a method to specify the memory by program (this is a logical memory specification method). Registers are used when specifying a memory by program. To read a program to be executed, a dedicated register called PC (program counter) is used. To write or read data, two 8-bit registers are used as a 16-bit register.
Another is physical specification of memory by hardware. To specify a specific address of memory, signal lines for specifying are used. In other words, by using a 16-bit register and 16 address signal lines, the target memory can be specified from the 64 KB. Data is then written to or read from the memory by using control signals.
Although the memory of a microcontroller is specified in 16 bits, not all of the 16 bits are always used. The memory is divided into several areas, so that a memory area can be specified more easily. These areas include areas called an SFR (special function registers to which peripheral I/O functions are assigned) area and saddr area of the 8-bit microcontrollers in the 78K0 and 78K0S Series. These areas are assigned a dedicated instruction code, and a peripheral function and memory in them can be specified by using an address of only 8 bits. This is similar to not having to dial the area code of a telephone number when you call a local number. In the case of a microcontroller, however, you can also specify an address by fully using 16 bits (i.e., by also dialing the area code).

[Coffee break]
Most telephones (pushbutton telephones) have a one-touch dialing or abbreviated dialing function. The 8-bit microcontroller has a similar function. Subroutine call usually requires 16 bits for specifying an address and therefore, the instruction is 3 bytes long. There is a function, however, that enables a subroutine to be called by 1 byte (i.e., a function to place a call by pressing only one button). This function is performed by using the instruction called CALLT instruction. This instruction registers the address of a subroutine to a specific table (like a telephone directory) in advance. When a number in that table is specified by a dedicated instruction, subroutines in the corresponding addresses can be called. In addition, a 2-byte subroutine instruction called CALLF is also available. This instruction limits the addresses of subroutines to a specific area.

There will be no problem if the memory fits into 64 KB, but there will be a problem if you want to specify memory of more than 64 KB with an 8-bit microcontroller (i.e., the memory cannot be specified as is). There are functions to extend an address at this time, such as a relatively simple bus switching method and a sophisticated address relocation method. The bus switching method is employed for the 78K0/Kx2 and the address relocation method was used for the 16-bit V53.
(Also refer to FAQ on memory banks.)
Note: The saddr area is located at 0FE20H to 0FF1FH of the 78K0 and 78K0S. This area as the features that it can be accessed more quickly than the other areas and that there are many instructions that can be used for accessing this area. This area can also be used as extended registers if the registers are insufficient.
Is this information useful for you ?
back to top  
(2006/05)









































 LEGAL  RSS Feeds       © 1995-2008  NEC Electronics Corporation