Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
11 views

Introduction to RISC based architecture

The document provides an overview of the architecture and components of the PIC microcontroller, emphasizing its RISC-based design and Harvard architecture. It details the CPU structure, memory organization, serial communication protocols, I/O ports, and various modules such as timers and converters. Additionally, it explains different addressing modes supported by the PIC microcontroller, including immediate, direct, register indirect, and indexed ROM addressing modes.

Uploaded by

Sk Surya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Introduction to RISC based architecture

The document provides an overview of the architecture and components of the PIC microcontroller, emphasizing its RISC-based design and Harvard architecture. It details the CPU structure, memory organization, serial communication protocols, I/O ports, and various modules such as timers and converters. Additionally, it explains different addressing modes supported by the PIC microcontroller, including immediate, direct, register indirect, and indexed ROM addressing modes.

Uploaded by

Sk Surya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Unit-V

Introduction to RISC based architecture

1. Sketch and explain the CPU architecture of PIC microcontroller.

 PIC Microcontroller architecture is based on Harvard architecture and supports RISC


architecture (Reduced Instruction Set Computer). PIC microcontroller architecture consists of
memory organization (ram, rom, stack), CPU, timers, counter, ADC, DAC, serial communication,
CCP module and I/O ports. PIC microcontroller also supports the protocols like CAN, SPI, UART
for interfacing with other peripherals.

1. CPU (Central Processing Unit):

 PIC microcontroller’s CPU consists of

 Arithmetic logic unit (ALU)


 Memory unit (MU)
 Control unit (CU)
 Accumulator
 ALU is used for arithmetic operations and for logical decisions. Memory is used for storing the
instructions after processing. Control unit is used to control the internal and external
peripherals which are connected to the CPU and accumulator is used for storing the results.

2. Memory Organization:

PIC microcontroller memory module consists of mainly 3 types of memories:


(i) Program memory:

 It contains the written program after we burned it in microcontroller.


 Program Counter executes commands stored in the program memory, one after the other.
 Pic microcontroller can have 8K words x 14 bits of Flash program memory that can be
electrically erased and reprogrammed.
(ii) Data memory:

 It is a RAM type which is used to store the data temporarily in its registers.
 The RAM memory is classified into banks. Each bank extends up to 7Fh (128 bytes).
Number of banks may vary depending on the microcontroller.
 PIC16F84 has only two banks. Banks contain Special Function Registers (SFR) and
General Purpose Registers (GPR).
 The lower locations of each bank are reserved for the Special Function Registers and
upper locations are for General Purpose Registers.
(a) General Purpose Registers (GPR):

 These registers don’t have any special function. These are used for general purpose for
multiplying, addition or subtraction and then storing the results in other registers. CPU
can easily access the data in these registers.
(b) Special Function Registers (SFR):

 These registers are used for special purposes and they cannot be used as normal
registers. Their function is set at the time of manufacturing. They perform the function
assigned to them and user cannot change the function of SFR. Three important SFRs for
programming are:
STATUS register: It changes the bank
PORT registers: It assigns logic values 0 or 1 to the ports
TRIS registers: It is a data direction register for input and output
(c) Data EEPROM:

 This memory allows storing the variables as a result of burning the written program.
 It is readable and writable during normal operation (over the full VDD range). This
memory is not directly mapped in the register file.
 It is indirectly addressed through the SFRs. There are six SFRs which are used to read
and write to this memory (EECON1, EECON2, EEDATA, EEDATH, EEADR, EEADRH).
3. Serial communication:

 The transfer of one bit of data at time consecutively over a communication channel is called
Serial Communication. There are three protocols of serial communication:
 USART: It stands for Universal Synchronous and Asynchronous Receiver and
Transmitter which provides a serial communication in two devices. In this protocol
data is transmitted and received bit by bit through a single wire according to the clock
pulses. To send and receive data serially the PIC microcontroller has two pins TXD and
RXD.
 SPI Protocol: SPI stands for Serial Peripheral Interface. It is used to send data
between PIC microcontrollers and other peripherals like sensors, shift registers and SD
cards. Three wire SPI communications is supported in PIC microcontroller between two
devices on a common clock source. SPI protocol has greater data handling capability
than that of the USART.
 I2C Protocol: I2C stands for Inter Integrated Circuit, and this protocol is used to connect
low speed devices like microcontrollers, EEPROMS and A/D converters.
PIC microcontroller support two wire Interface or I2C communication between two
devices which can work as both Master and Slave device.
4. Interrupts:

 There are 20 internal interrupts and three external interrupt sources in PIC microcontrollers
which are related with different peripherals like ADC, USART, Timers, and CCP etc.
5. I/O Ports:

 It consists of five ports, such as Port A, Port B, Port C, Port D and Port E.
 Port A: This port is 7-bit wide and can be used for both input and output. The status of
TRISA register decided whether it is used as input or output port.
 Port B: It is an 8-bit port. This port also can be used as input and output. Moreover in input
mode four of its bits are variable according to the interrupt signals.
 Port C: It is also an 8-bit port and can be used as both input and output port which is
determined by the status of the TRISC register.
 Port D: This 8-bit port, unlike Port A, B and C is not an input/output port, but is used as
acts as a slave port for the connection to the microprocessor ,When in I/O mode Port D all
pins should have Schmitt Trigger buffers.
 Port E: It is a 3-bit port which is used as the additional feature of the control signals to the
A/D converter.

6. CCP Module:

 A CCP module works in the following three modes:


 Capture Mode: In this mode time is captured when a signal is arrived, or we can say
that, when the CCP pin goes high it captures the value of the Timer 1.
 Compare Mode: It works same as an analog comparator, which means that when timer
1’s value reaches some reference value it will give an output signal.
 PWM Mode: This mode provides a 10 bit resolution pulse and duty cycle that is
programmable.
7. Timers:

 PIC microcontroller can have up to four timers (depending upon the family) Timer0, Timer1,
Timer2 and Timer3.
 Timer0 and Timer2 are of 8-bits while the Timer1 and Timer3 are of 16-bits, which can also be
used as a counter. These timers work according to the selected modes.

8. D/A Converter:

 There are no analog outputs in PIC Microcontroller.


 It can convert 8 bits of digital number from the eight digital outputs of PIC microcontroller.

9. A/D Converter:

 It converts the analog voltage levels to digital voltage values.


 In PIC Microcontroller, ADC has 8-channels and has resolution of 10-bit, which means that if
we have to convert an analog voltage between 0V to 5V the converter will divide it to 2^10
levels (1024 levels).
 The special function registers ADCON0 and ADCON1 control the operation of ADC. The
converter stores the lower 8 bits in ADRESL register and the upper bits in the ADRESH
register. Reference voltage of 5V is required for the operation of the converter.
2. Explain the different addressing modes of PIC micro controller.
 The PIC 18 microcontroller supports following addressing modes.
a) Immediate addressing mode
b) Direct addressing mode
c) Register addressing mode
d) Indexed ROM addressing mode
a) Immediate addressing mode:
 In immediate addressing mode, the immediate data is specified in the instruction.
 The immediate addressing mode is used to load the data into PIC registers and WREG
register.
 However, it cannot use to load data into any of the file register.

Example:

1. MOVLW 50H
2. ANDLW 40H
3. IORLW 60H

b) Direct addressing mode:


 In direct addressing mode, the 8- bit data in RAM memory location whose address is
specified in the instruction.

 This mode is used for accessing the RAM file register.

Example:

1. MOVWF 0X10
2. MOVFF PORTB, POTRC
3. MOVFF 0X30, PORTC

c) Register indirect addressing mode:


 Register indirect addressing mode is used for accessing data stored in the RAM part of
file register.

 In this addressing mode a register is used as pointer to the memory location of the file
register.

 Three file select registers are used. They are FSR0, FSR1 and FSR2.

Example:
1. LFSR1,0X55
2. MOVWF INDF2

d) Indexed ROM addressing mode:


 This addressing mode is used for accessing the data from look up tables that reside in
the PIC18 program ROM.

You might also like