MCU and program design (on)

In the "peripheral functions that the MCU must understand - GPIO/serial communication" and "Peripheral functions that must be understood by the MCU - Timer/Interrupt function" , the program design using the functions of the MCU is explained. The MCU has a built-in peripheral function that is very easy to use. You must also feel the ability of the MCU to handle various requirements. However, if you want to run the microcontroller effectively, the program is indispensable, how does the program work? From the beginning of this issue, we will introduce the relationship between the microcontroller and the program.

Pay attention to the memory of the microcontroller

Prior to this, the GR-SAKURA board (equipped with Renesas electronic microcontroller "RX63N") was designed using a Web compiler. The program (Object Code) built by the compiler is transferred to the GR-SAKURA board just like a USB flash drive. Well, the problem is coming. Where should the program written to (transfer to) the microcontroller be stored? In addition, how is the program executed? While answering these questions, let us take a look at the relationship between the microcontroller and the program.

First, let's understand the two functions of memory, main memory and external memory.

The place where the program and data are memorized (storage) is the memory. There are two types of memory.

MCU and program design (on)

Programs in the external memory must be transferred to the main memory before they can be executed.

Regarding the memory of the single-chip microcomputer, words such as a ROM (Read Only Memory) and a RAM (Random Access Memory) are often seen. In fact, the ROM and the RAM only indicate the memory property, and are independent of the function of the memory. (Please refer to the introduction of the microcontroller 1 to understand the basic structure and operation of the microcontroller)

Address space (memory space)

All the space that the CPU can directly read and write is called "address space (or memory space)". Each byte of this address space is labeled with a number. This number is called "address" and is usually expressed in hexadecimal. The main memory described above is included in the address space.

According to different purposes, the CPU of the microcontroller has developed 4 bits, 8 bits, 16 bits and 32 bits. The RX63N microcontroller used in GR-SAKURA is equipped with a 32-bit CPU, so it is also called a "32-bit microcontroller." So, what is the address space capacity of the microcontroller? Taking the RX63N as an example, since it is a 32-bit CPU, it is possible to specify a maximum of about 4 billion (2 to 32 power) addresses. Specifically, 4,294,967,296 (4x1024x1024x1024) addresses. Since an address can memorize one byte, it can also be expressed as having "4GB (gigabytes) of address space". The larger the capacity of the address space, the larger the capacity of the memory, and the larger the program. This enables higher functionality applications.

An example of a 4 Gbyte address space owned by a 32-bit CPU is shown in Figure 1. The address shown on the left is the address in hexadecimal. Since a column holds 4 bytes (= 32 bits), the address marked on the left is the value of every 4 addresses.

Figure 1: Address space and label example

Computer units: bit, byte, mega, gigabit, and terabyte (too)

The basic unit of data is bits (b=bit), and the value of each bit is "0" or "1". 8 bits are 1 byte (B=Byte). For example, 3 bytes (3 & TImes; 8 bits) are equivalent to 24 bits.

The units used for the capacity of computer storage devices are familiar to KB (kilobytes), MB (megabytes), GB (gigabytes), and TB (terabytes). In general, it will say 1GB=1000MB or write it like this, but in the world of computers, this unit is not 1000 times, but 1024 times (2 to the power of 10), so the correct representation is as follows:

1KB (kilobytes) = 2 to the power of 10 = 1,024 bytes

1MB (megabytes) = 1,024KB = 2 to the power of 20, 1,48,576 bytes

1GB (gigabytes) = 1,024MB = 2 to the 30th power = 1,073,741,824 bytes

1TB (terabyte) = 1,024GB = 2 to the 40th power = 1,099,511,627,776 bytes

What does the hexadecimal value of the address mean?

The address in the address space is expressed in hexadecimal. For example, if you have a 16-bit (2 to the 16th power) size of the address space, if it is expressed in decimal, it is "from address 0 to address 65535". If it is expressed in hexadecimal, it is from address 0h. Go to address FFFFh". In decimal, each bit takes a value between 0 and 9, and in hexadecimal, it is 0 to F (equivalent to 15 in decimal). The number in hexadecimal, and finally there is an "h", which is indicated in hexadecimal.


Smart Board With Projector

Smart board with paojector:The smart board supports wireless projection from Apple or Android phones, wired projection from windows computer and MAC, wireless projection, and computer with reverse mirror image projection.

smart board with paojector,Mobile screen sharing,MAC screen sharing,smart board projector,smart board notebook,all in one smartboard

Jumei Video(Shenzhen)Co.,Ltd , https://www.jmsxdisplay.com

Posted on