EE6008 MBSD
EE6008 MBSD
3003
OBJECTIVES:
To introduce the architecture of PIC microcontroller
To educate on use of interrupts and timers
To educate on the peripheral devices for data communication and transfer
To introduce the functional blocks of ARM processor
To educate on the architecture of ARM processors
TOTAL: 45 PERIODS
OUTCOMES:
To understand and apply computing platform and software for engineering problems.
To understand ethical issues, environmental impact and acquire management skills.
TEXT BOOKS:
1. Peatman,J.B., ―Design with PIC Micro Controllers‖PearsonEducation,3rdEdition, 2004.
2. Furber,S., ―ARM System on Chip Architecture‖ Addison Wesley trade Computer Publication,
2000.
REFERENCE:
1. Mazidi, M.A.,―PIC Microcontroller‖ Rollin Mckinlay, Danny causey Printice Hall of India, 2007.
UNIT I
INTRODUCTION TO PIC MICROCONTROLLER
Introduction to PIC Microcontroller–PIC 16C6x and PIC16C7x Architecture– PIC16cxx–- Pipelining
– Program Memory considerations – Register File Structure – Instruction Set – Addressing modes –
Simple Operations.
PART-A
1. What is PIC microcontroller?
PIC stands for Peripheral Interface Controller coined by Microchip Technology to identify its single
chip microcontrollers. These devices have been phenomenally successful in 8-bit microcontroller
market. The main reason is that Microchip Technology has constantly upgraded the device
architecture and added needed peripherals to the microcontroller to ‘suit customers‘ requirements.
2. What are the PIC16C6X Microcontroller Core Features?
High performance RISC CPU
• Only 35 single word instructions to learn
• All single cycle instructions except for program branches which are two-cycle
• Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle
• Interrupt capability
• Eight level deep hardware stack
• Direct, indirect, and relative addressing modes
• Power-on Reset (POR)
• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code-protection
• Power saving SLEEP mode
• Selectable oscillator options
Low-power, high-speed CMOS EPROM/ROM technology
Fully static design
Wide operating voltage range: 2.5V to 6.0V
Commercial, Industrial, and Extended temperature ranges
Low-power consumption:
< 2 mA @ 5V, 4 MHz
15mA typical @ 3V, 32
kHz
< 1mA typical standby current
3.What are the PIC16C6X Microcontroller Peripheral Features
Timer0: 8-bit timer/counter with 8-bit prescaler
Timer1: 16-bit timer/counter with prescaler,can be incremented during sleep via
external crystal/clock
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
Capture/Compare/PWM (CCP) module(s)
Capture is 16-bit, max resolution is 12.5 ns, Compare is 16-bit, max resolution is
200 ns,PWM max resolution is 10-bit.
Synchronous Serial Port (SSP) with SPI and I2C
Universal Synchronous Asynchronous ReceiverTransmitter (USART/SCI)
Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls.
Brown-out detection circuitry for Brown-out Reset (BOR)
These devices are known as low-end architectures. Some of the low-end device past numbers
are 12C5XX, 16C5X, and 16C505
C: Carry/borrow bit
DC: Digit carry/borrow bit
Z: Zero bit
NOT_PD : Reset Status bit (Power-down mode bit)
NOT_TO : Reset Status bit (tme- out bit)
RPO: Register bank Select
The bits 7 and 6 of Status Register are unused by 16c6x/7x. The ‗C‘ bit is set when two
8-bit operands are added together and a 9-bit result occurs. This 9-bit is placed in the carry bit.
The DC or Digit carry bit indicates that a carry from the lower 4 bits occurred during an 8-bit
addition.
Example: 0011 1000
0011 1000
0111 0000
Here DC=1 as a result of the carry from the bit 3 to the bit 4 position.
The Z or zero bits is affected by the execution of arithmetic or logic instructions.
18. What is FSR – (File Select Register):
It is the pointer used for indirect addressing. In the indirect addressing mode the 8-bit register
file address is first written into FSR. It is a special purpose register that serves as an address
pointer to any address throughout the entire register file.
19. What isINDF – (Indirect File):
It is not a physical register addressing but this INDF will cause indirect addressing. Any
instruction using the INDF register actually access the register pointed to by the FSR.
20. What is PROGRAM COUNTER
PIC has a 13 bit program counter in which PCL is the lower 8-bits of the PC and PCLATH
is the write buffer for the upper 5 bits of the PC.
PCLATH (program counter Latch can be read or from or written to without affecting the
Program Counter(PC).The upper 3 bits of PCLATH remain zero.It is only when PCL is written
to that PCLATH is automatically written into the PC at the same time.
21. What is the PARALLEL I/O Ports of PIC Microcontroller?
Most of the PIC16cx/7x family controllers have 33 I/O lines and five I/O ports They are PORT
A, PORT B, PORT C , PORT D and PORT E.
PORT A:
Port A is a 6-bit wide bi-directional port. Its data direction register is TRISA setting TRISA bit
to 1 will make the corresponding PORT A Pin an input. Clearing a TRIS a bit will make the
corresponding pin as an output.
PORT B:
Port B is an 8-bit wide, bi-directional port. Four of the PORT B pins RB7 – RB4 have an
interrupt-on- change feature. Only the pins configured as inputs can cause this interrupt to
occur.
PORT C:
Port C is an 8-bit wide, bidirectional port. Bits of the TRISC Register determine the
function of its pins. Similar to other ports, a logic one 1 in the TRISC Register configures the
appropriate port pin as an input.
PORT D:
Port D is an 8-bit wide bi-directional port. In addition to I/O port, Port D also works as
8-bit parallel slave port or microprocessor port. When control bit PSPMODE (TRISE:4) is set.
PORT E:
It is a 3-bit bi-directional port. Port E bits are multiplexed with analog inputs of ADC
and they serve as control signals (RD , WR, CS) for parallel slave port mode of operation.
22. What is the Program memory?
The PIC has 4k x14 program memory space (0000H-0FFFH).It has a 13 bit Program
counter(PC) to access any address (213=4k). This PIC family uses 13-bit program counter
allowing the controllers to an 8k-program memory without changing the CPU structure.
23. What is Data Memory?
The data memory of PIC is partitioned into multiple banks which contain the general purpose
registers and the Special function Registers.(SFRs).The bits RP1 and RP0 bits of the status
register are used to select these banks.Each bank extends upto 7FH(128 Bytes).The lower bytes
of the each bank are reserved for the Special Function Registers.Above the SFRs are general
purpose registers implemented as static RAM.
24. Write the status register of 16c6x.
0 0 RPO TO PD Z DC C
PART-A
1.What are the Two papermeters of interrupt source i
The minimum time interval between interrupts from source, denoted by TPi
The maximum time it takes the CPU to execute the interrupt source‘s handler subroutine and
its call from within Intservice , denoted by Ti.
The minimum time interval between interrupt for a given interrupts source is determined by the
application
9600Bd UART , Each 8-bit character is framed between a start bit and stop bit. When a bit time of
1/9600, each 10 bit frame (i.e., each character) can arrive 10/9600 seconds apart:
TPUART= 10/9600 second = 10,000,000/9600 s =1042 s .
The maximum time interval (Capture/Compare /PWM)facility must be dealt with before another CCP
interrupt occurs.
TPCCP= 1/4000 second = 1,000,000/4000 s =250 s
2.What is GIE ?
Global interrupt enable bit, GIE (INTCON) enables all un-masked interrupts (if GIE set) or disables (if
GIE cleared) all interrupts. When bit GIE is enabled, and an interrupt flag bit and mask bit are set, the
interrupt will vector immediately. Individual interrupts can be disabled through their corresponding
enable bits in the INTCON register. GIE is cleared on reset.
3. What is WATCH DOG TIMER (WDT):
The Watchdog Timer is a free running on-chip RC oscillator which does not require any external
components. This RC oscillator is separate from the RC oscillator of the OSC1/CLKIN pin. That
means that the WDT will run, even if the clock on the OSC1/CLKIN and OSC2/CLKOUT pins of the
device has been stopped, for example, by execution of a SLEEP instruction. During normal operation,
a WDT time-out generates a device reset. If the device is in SLEEP mode, a WDT time-out causes the
device to wake-up and continue with normal operation. The WDT can be permanently disabled by
clearing configuration bit WDTE.
4.Write the WATCH DOG TIMER REGISTER
5.Write the interrupts Which wake up the peripheral interrupts from SLEEP.
The following peripheral interrupts can wake the device from SLEEP:
1. TMR1 interrupt. Timer1 must be operating as an asynchronous counter.
2. SSP (Start/Stop) bit detect interrupt.
3. SSP transmit or receive in slave mode (SPI/I2C).
4. CCP capture mode interrupt.
5. Parallel Slave Port read or write.
6. USART TX or RX (synchronous slave mode).
6.What is TIMER 0 ?
The Timer0 module is a simple 8-bit overflow counter.
The clock source can be either the internal system clock or an external clock
When the clock source is an external clock, the Timer0 module can be selected to increment on
either the rising or falling edge.
The Timer0 module also has a programmable prescaler option.
This prescaler can be assigned to either the Timer0 module or the Watchdog Timer.
Bit PSA (OPTION) assigns the prescaler, and bits PS2:PS0 (OPTION) determine the prescaler
value.
TMR0 can increment at the following rates: 1:1
when the prescaler is assigned to Watchdog Timer, 1:2, 1:4, 1:8, 1:16, 1:32, 1:64, 1:128, and
1:256. Synchronization of the external clock occurs after the prescaler.
When the prescaler is used, the external clock frequency may be higher then the device‘s frequency.
The maximum frequency is 50 MHz, given the high and low time requirements of the clock.
The conversion of number entered digit by digit from a keybad into its binary equivalen
The display of fixed and variable strings of characters
12. What is the sequence for KEYSTATE?
For the instrument design the display plus either key switches or a rotary pulse generator
(RPG ) in their design of the front panel.
The dispay serves to display measurement
The display combines key switches ot RPG for the entry of setup parameters
PART-B
1.Discuss the interrupt structure in PIC microcontrollers. List out the various interrupt sources inPIC
16c7x
2.Explain the timer of the PIC microcontroller
3.Explain the prescalar timer0.
4.Explain the Watchdog timer of PIC microcontroller.
5.Explain RB0 /INT external interrupt input
6.Explain the Compare mode
7.Explain the Capture mode
8.xplain the Timer1 CCPperiodscaler.
9.Explain the PortB change interrupts(RB7:RB4)
10. Write about Display of variable strings
11. Write a program for display of constant strings
UNIT-III
PERIPHERALS AND INTERFACING OF PIC MICROCONTROLLER
I2C Bus for Peripherals Chip Access– Bus operation-Bus subroutines– Serial EEPROM—Analog to
Digital Converter–UART-Baud rate selection–Data handling circuit–Initialization – LCD and
keyboard Interfacing -ADC, DAC, and Sensor Interfacing.
PART-A
1. What are the different capture modes available in the capture module of PIC
microcontroller? (June’12)
Three modules are there.
(i) CCP1
(ii) CCP2
(iii) CCP3
2. Write the function of the bits EEPGD and WRERR bits in the EECONI
register in PIC Microcontroller. (June’12)
EEPGD-Flash Program or Data EEPROM Memory select bit
1=Access Program flash memory; 0= Access data EEPROM memory
3. Calculate the resolution of 10bit ADC having Max. analog value +10.0 volts. (June /
July 2013)
Resolution of a converter determines the degree of accuracy in conversion. It is equal to
1/2nso, 1/210=0.000976
4. What are the interrupts available in PIC? (Jan’14)
7. Using PIC micro controller how is analog signal converted into digital. (Jan’13)
ADC to translate the analog signals to digital numbers. So, that the microcontroller can read
and process them.
9. Brief timer0.
It is an 8 bit wide timer. Internal clock is fosc/4 and external clock is given at RA4
pin.It is used for timing and generating time delay.
I²C defines basic types of messages, each of which begins with a START
and ends with a STOP:
Single message where a master writes data to a slave;
Single message where a master reads data from a slave;
Combined messages, where a master issues at least two reads and/or writes to
one or more slaves.
PART – B
1. Discuss the flash type ADC and its applications. Also explain how to interface it with
PIC.
3. Discuss in detail about the following (i) Timers and (ii) Interrupt (Jan‘13)
4. (i).Discuss in detail of I2C in PIC microcontroller. (Jan‘13)
(ii). Briefly explain about UART in PIC microcontroller.(Jan‘13)
5. Explain the I/O ports in PIC microcontroller.
6. Briefly explain about flash memory in PIC with necessary diagram.
7. Discus briefly about LCD & key board interfacing in PIC?
UNIT IV
INTRODUCTION TO ARM PROCESSOR
PART – A
1. What is ARM Processor?
An ARM processor is one of a family of CPUs based on the RISC (reduced instruction
set computer) architecture developed by Advanced RISC Machines (ARM).ARM
makes 32-bit and 64-bit RISC multi-core processors. RISC processors are designed to
perform a smaller number of types of computer instructions so that they can operate at
a higher speed, performing more millions of instructions per second (MIPS).
18
15. What is the function of assembler?
The ARM assembler is a full assembler which produces ARM object format output
that can be linked with output from the compiler.
18. What is meant by ARMulator? And list the various levels of accuracy.
The ARMulator (ARM emulator) is a suite of programs that models the behavior of
various ARM processor core in software on a host system.
Various levels of accuracy:
Instruction accurate
Cycle accurate
Timing accurate
19
Separate instruction cache and data caches.
N: Negative; the last ALU operation which changed the flags produced a
negativeresult (the top bit of the 32-bit result was a one).
Z: Zero; the last ALU operation which changed the flags produced a zero
result(every bit of the 32-bit result was zero).
C: Carry; the last ALU operation which changed the flags generated a carry-out,either
as a result of an arithmetic operation in the ALU or from the shifter.
V: overflow; the last arithmetic ALU operation which changed the flags generatedan overflow into the
sign bit
20
31. What are the ARM Processor Modes.
User mode: a normal program execution state
FIQ (Fast Interrupt Request) mode :for supporting a specific data transfer or
channel processing
IRQ (Interrupt ReQuest) mode:for general purpose interrupt handling
Supervisor mode:a protected mode for the operating system
Abort mode:entered when a data or instruction pre-fetch is aborted
System mode:a privileged user mode for the operating system, for
example, implement reentrant interrupt handler
Undefined mode:entered when an undefined instruction is executed.
Operating mode changes :Can be controlled by software.
Can also be caused by external interrupts or exception
Processing
Exception mode
System mode
21
38. What is Program Status word in ARM
processor The format of CPSR and SPSR are
the same
Called PSR in general
One CPSR (Current Program Status Register)
Copies of the Arithmetic Logic Unit(ALU) status
flags The current processor mode
Interrupt disable flags
Five SPSR (Saved Program Status Registers)
Used to store the CPSU when an exception is taken
One SPSU is accessible in each of the exception-handling mode
User mode and System modedo not have an SPSR because they are not
exception handling modes
PART – B
22
UNIT V
ARM ORGANIZATION
PART - A
1. What are the principal components of 3 stage pipelining?
The register bank, which stores the processor states
The barrel shifter, which can shift or rotate one operand by any number of bits
The ALU, which performs the arithmetic and logic functions required by the
instruction set.
The address register and incrementer, which select and hold all memory
address.
The data registers, which hold data passing to and from memory.
The instruction decoder and associated control logic.
2. What are the pipe lines stages in three stage pipe lining?
Fetch:The instruction is fetched from memory and placed in the instruction pipeline.
Decode:The instruction is decoded and the datapath control signals prepared
for the nextCycle. In this stage the instruction 'owns' the decode logic but not
the datapath.
Execute:The instruction 'owns' the datapath; the register bank is read, an
operand shifted,the ALU result generated and written back into a destination
register.
23
Write-back
9. What are the handshake signals used by the ARM co-processor interface?
Cpi (from ARM to all co-processor)
Cpa (from the co-processor to ARM)
Cpb (from the co-processor to ARM)
12. How ARM architecture will support for high level language?
A High level language allows the programmer to think in terms of abstraction that are
above the machine level; indeed, the programmer may not even know on which
machine the program will ultimately run. Parameter such as number of registers vary
from architecture to architecture, so clearly these must not be reflected in the design of
the language.
24
Int main ()
{
Printf ( ― Hello World\n‖) ;
return
( 0 ); }
14. Write the number 2001 in 32 bit binary, binary-coded decimal, ASCII and single-
precision floating point notation.
25
Embeddable hardware to give on-chip breakpoint and watch point support.
Also it must move the data values into registers before using them
26
11. Define ARM 7TDMI processor.
The ARM7TDMI processor is a member of the Advanced RISC machine
family of general purpose32-bit microprocessor.
12. What are the two operating states in ARM7TDMI?
ARM state which executes 32-bit, word aligned ARM instructions–THUMB state
which can execute 16-bit, half word aligned THUMB instructions
13. List the seven modes of operation of ARM7TDMI.
User (USR)–
FIQ (FIQ)–
IRQ (IRQ)–
Supervisor (SVC)–
Abort mode (ABT)–
System (SYS)–
Undefined (UND)
14. How many registers are available in
ARM7TDMI? There are totally 4.There are totally
37 registers.
•31 general-purpose 32-bit registers
•6 status registers•
22. Explain about the Branch, Branch with Link and exchange.
These instructions are available on ARM chips which support the Thumb (16-bit) instruction
set,and are a mechanism for switching the processor to execute Thumb instructions or for
returningsymmetrically to ARM and Thumb calling routines.
24. Explain the processor operations for the execution of software interrupt
If the condition is passed the instruction enters supervisor mode using the standard ARM
exceptionentry sequence. In detail, the processor actions are:1. Save the address of the
instruction after the SWI in r14 svc.2. Save the CPSR in SPSR svc.3. Enter supervisor mode
and disable IRQs (but not FIQs) by setting CPSR [4:0] to100112 and CPSR [7tol].4. Set the
PC to 08 and begin executing the instructions there.
to the ALU, allowing, for example, shift and add in asingle instruction
26. Explain about single word and unsigned byte data transfer instruction.
These instructions are the most flexible way to transfer single bytes or words of data
betweenARM's registers and memory. Transferring large blocks of data is usually better
done using themultiple register transfer instructions, and recent ARM processors also
support instructions fortransferring half-words and signed bytes.
27. Explain about half word and signed byte data transfer.
These instructions are not supported by some early ARM processors. As a result of their
lateaddition to the architecture they are somewhat 'shoe-horned' into the instruction space as
indicatedby the split immediate field.
28
• Signed and unsigned long integers of at least 32 bits.
• Floating-point, double and long double floating-point numbers.
• Enumerated types.
• Bit fields.
The ARM C compiler adopts the minimum sizes for each of these types except the standard integer.
PART – B
1. Explain in detail about 3 stage pipelining ARM organization.
2. Explain in detail about 5 stage pipelining ARM organization.
3. Explain in detail about ARM instruction execution unit.
4. Explain in detail about Branch instruction Software Interrupt instruction(SWI)
5. Write short notes for the following coprocessor instruction, data operation, data
transfer, register transfer operation.
6. Explain in detail about ARM floating point architecture .
7. Describe the hierarchical program structure.
29