Tuesday, 20 October 2015

How does a Processor or Controller access data from Memory ? and What is Raspberry Pi ?


Accessing data from memory in a microcontroller (MCU).


Microprocessor and MCUs are different in that, microprocessors do not have inbuilt data memory (RAM) and program memory (ROM), where as MCUs have both on the chip itself.

In MCUs, operation codes, operands and results are stored in the memory space (RAM and ROM), which is organised into banks segments or pages.

Therefore an arrangement is needed for reaching a location in the data memory space, where the desired operands required by an instruction are stored and where the results after execution of the instruction, if required, are to be stored.

An addressing mode specified how to calculate the effective memory address of an operand by using the information held in registers and/or constants contained within a machine instruction.

Addressing mode depend on the design of the central processing unit (CPU), memory space and organisation of the register. These differ from MCUs of one brand to another.

There are different ways for addressing a location in the memory space, which are called immediate, register direct, absolute, address register indirect, address register relative and relative. In short, data is loaded in data memory space and has address. To get the data, the address is computed by the addressing mechanism.

Let us see how data memory is managed in microcontroller PIC18F4520. Data memory is organised in 16 banks. However, only six banks have been implemented. Each bank has 256 slots and each slot of memory can accommodate one byte or eight bits. So, the addressing mechanism has to compute the address for one slot out of 1536 slots.

Twelve bits will be needed for this; four bits from the bank selecting register (BSR) for selecting the bank. Once we are in that bank, further eight bits will be required for selecting the intended slot out of 256 slots in the made up in a different upon the addressing mode.

In direct addressing mode, all 12 bits are provided by the instruction.

In indirect addressing mode , the instruction provides the pointer and from that pointer, 12 bits are conjured to compute the selection of the bank and address of the intended location in that bank.


What is Raspberry Pi ?


Raspberry Pi, or Raspi, is a computing system that uses a Raspi board, laptop, standard keyboard, mouse, computer monitor or TV, micro USB cable, micro SD card with adaptor, HDMI cable and network cable for its operations. Programming is done in languages likes Python, Wiring Pi, C/C++ and PHP.



 It is capable of doing everything that is expected from a desktop computer, from browsing the Internet and playing high-definition video to making spreadsheets and playing games. The system has the ability to interact with the outside world and has been used in many projects, from music machines to weather station.


Raspi board has 26 dedicated GPIO pins, including a UART, an I2C bus, SPI bus with two chip selects,I2S audio, 3.3V, 5V and ground. The maximum number of GPIOs can theoretically be indefinitely expanded by making use of the I2C or SPI bus.

Interfacing of the camera module is an interesting application of Raspi. It can take high-definition videos as well as still photographs.