Top Banner
Experiment no: 1 Objective: Write basic C- programs for I/O operations. Program Description : This programs demonstrate General Purpose Input Output by blinking 8 LED’s. Part List: 1. OASIS ARM7 BOARD. 2. RS232 Serial cable 3.9 Volt DC Power supply. 4. Triton IDE Theory: LED’s are interfaced to General Purpose I/O port (GPIO) of Arm (LPC2148). So first we will see the properties of GPIO Features of GPIO Every physical GPIO port is accessible via either the group of registers providing an enhanced features and accelerated port access or the legacy group of registers Accelerated GPIO functions: GPIO registers are relocated to the ARM local bus so that the fastest possible I/O timing can be achieved Mask registers allow treating sets of port bits as a group, leaving other bits unchanged All registers are byte and half-word addressable
37
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Embedded System

Experiment no: 1

Objective: Write basic C- programs for I/O operations.

Program Description : This programs demonstrate General Purpose Input Output by blinking 8 LED’s.

Part List:

1. OASIS ARM7 BOARD.

2. RS232 Serial cable

3.9 Volt DC Power supply.

4. Triton IDE

Theory:

LED’s are interfaced to General Purpose I/O port (GPIO) of Arm (LPC2148). So first we will see the properties of GPIO

Features of GPIO

Every physical GPIO port is accessible via either the group of registers providing an enhanced features and accelerated port access or the legacy group of registers

• Accelerated GPIO functions: – GPIO registers are relocated to the ARM local bus so that the fastest possible I/O timing can be achieved – Mask registers allow treating sets of port bits as a group, leaving other bits unchanged – All registers are byte and half-word addressable – Entire port value can be written in one instruction • Bit-level set and clear registers allow a single instruction set or clear of any number of bits in one port • Direction control of individual bits • All I/O default to inputs after reset • Backward compatibility with other earlier devices is maintained with legacy Registers appearing at the original addresses on the APB bus

Page 2: Embedded System

Applications of GPIO

• General purpose I/O• Driving LEDs, or other indicators• Controlling off-chip devices• Sensing digital inputs

GPIO pin description

Pin Type DescriptionP0.0-P0.31 Input/Output General purpose input/output. The number

of GPIOs actually available depends on the use of alternate functions.

P1.16-P1.31 Input/Output General purpose input/output. The number of GPIOs actually available depends on

the use of Alternate functions.

LPC2141/2/4/6/8 has two 32-bit General Purpose I/O ports. Total of 30 input/output and a single output only pin out of 32 pins are available on PORT0. PORT1 has up to 16 pins available for GPIO functions. PORT0 and PORT1 are controlled via two groups of 4 registers. All of these registers are located directly on the local bus of the CPU forthe fastest possible read and write timing. An additional feature has been added thatprovides byte addressability of all GPIO registers. The user must select whether a GPIO will be accessed via registers that provideenhanced features or a legacy set of registers

Register description

GenericName

Description Access PORT0Address &

Name

PORT0Address &

NameIOPIN GPIO Port Pin value register.

The current state of the GPIO configured port pins can

always be read from this register, regardless of pin direction.

R/W 0xE002 8000IO0PIN

0xE002 8010IO1PIN

IOSET GPIO Port Output Set register . 0xE002 8004 0xE002 8014

Page 3: Embedded System

This register controls the state of Output pins in conjunction with the

IOCLR register. Writing ones produces highs at the corresponding

port pins. Writing zeroes has no effect.

R/W IO0SET IO1SET

IODIR GPIO Port Direction control register. This register individually controls the

direction each port pin.

R/W 0xE002 8008IO0DIR

0xE002 8018IO1DIR

IOCLR GPIO Port Output Clear register, this register controls the state of output

pins. Writing ones produces lows at thecorresponding port pins and clears

the corresponding bits in the IOSET register.

wo 0xE002 800CIO0CLR

IO1CLR

GPIO usage notes

State of the output configured GPIO pin is determined by writes into the pin’s port IOSET and IOCLR registers. Last of these accesses to the IOSET/IOCLR register will determine the final output of a pin.In case of a code:IO0DIR = 0x0000 0080 ;pin P0.7 configured as outputIO0CLR = 0x0000 0080 ;P0.7 goes LOWIO0SET = 0x0000 0080 ;P0.7 goes HIGHIO0CLR = 0x0000 0080 ;P0.7 goes LOWpin P0.7 is configured as an output (write to IO0DIR register). After this, P0.7 output is setto low (first write to IO0CLR register). Short high pulse follows on P0.7 (write access toIO0SET), and the final write to IO0CLR register sets pin P0.7 back to low level

Now about the hardware interfacing

Page 4: Embedded System

LED Display Interface (Switch S5 1-2 Closed)

The following table lists the Oasis LED pin configurations.

Sr.no. Signal(LPC21xx)

Description(About LED)

1 Pin 45 (P0.15) LED 8 (L8)2 Pin 46 (P0.16) LED 7 (L7)3 Pin 47 (P0.17) LED 6 (L6)4 Pin 52 (P0.18) LED 5(L5)5 Pin 54 (P0.19) LED 4(L4)6 Pin 55 (P0.20) LED 3(L3)7 Pin 1 (P0.21) LED 2(L2)8 Pin 2 (P0.22) LED 1(L1)

‘LED Display Interface’

PROCEDURE:

1. Connect 9 V power supply to the OASIS TRITON BOARD.

2. Connect the Board with the COM port of the PC using serial cable.

3. Generate.hex file using Triton IDE.

4. Put the board in ISP mode and give reset.

5. Download the .hex file.

6. Put the board RUN mode give reset.

Algorithm:

Program:

Output : LED blinks continuously.

Conclusion:

Page 5: Embedded System

Experiment no: 2

Objective: Write basic C- programs for LCD display interfacing.

Program Description:

Part List:

1. OASIS ARM7 BOARD.

2. RS232 Serial cable

3.9 Volt DC Power supply.

4. Triton IDE

Theory:

LCD pin descriptions

The LCD has 14 pins. The functions of each pin are given in the following table.

Pin Symbol I/O Description

1 Vss - Ground2 Vcc - +5 V3 VEE - Power supply to control contrast4 RS I RS=0 to select command register

RS=1 to select data register

5 R/W I/O R/W=0 for write, R/W=1 for read6 E I/O Enable7 DB0 I/O The 8 bit data bus8 DB1 I/O The 8 bit data bus9 DB2 I/O The 8 bit data bus10 DB3 I/O The 8 bit data bus11 DB4 I/O The 8 bit data bus12 DB5 I/O The 8 bit data bus13 DB6 I/O The 8 bit data bus14 DB7 I/O The 8 bit data bus

Page 6: Embedded System

Register select (RS)

There are two very important registers inside the LCD. This RS pin is used for their selection as follows. If RS=0,the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home etc. if RS =1 the data register is selected, allowing the user to send data to be displayed on the LCD.

R/W read/write

R/W input allows the user to write information to the LCD or read information from it. R/W =1 when reading;R/W=0 when writing.

E, Enable

The enable pin is used by the LCD to latch information presented to its data pins.when data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins .This pulse must be a minimum of 450ns wide.

D0-D7

The 8-bit data pins, D0-D7,are used to send information to the LCD or read the contents of the LCD’s internal registers . To display the letters A-z and the numbers 0-9 to these pins we have to send the ASCII code by making RS=1.There are also the instruction command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor .The table given below gives the instruction command codes.

Code (Hex)

Command to LCD instruction register

1 Clear the display 2 Return home4 Decrement cursor (shift cursor to left)6 increment cursor (shift cursor to right)5 Shift display to right7 Shift display to left8 Dislplay off,cursor offA Dislplay off,cursor onC Dislplay on,cursor offE Dislplay on,cursor blinkingF Dislplay on,cursor blinking10 Shift cursor positon to left14 Shift cursor positon to right18 Shift entire display to the left 1C Shift entire display to the right80 Force cursor to beginning of 1st line

Page 7: Embedded System

C0 Force cursor to beginning of 2nd line38 2 lines and 5×7 matrix

To send any of the command to the LCD make RS=0, for data make RS=1. Then high send to low pulse to E pin to enable the internal latch of LCD.

LCD Display Interfacing:

10 K Pot

‘LCD Display interface’

LCD Display Interface (Switch S6 1-2 closed)The following table lists details about the LCD display interface with the tritan board.

Sr.No Signal(LPC21xx)

DescriptionLCD

1 Pin 16 (P1.16) Data 02 Pin 12(P1.17) Data 13 Pin 8 (P1.18) Data 24 Pin 4 (P1.19) Data 35 Pin 48 (P1.20) Data 46 Pin 44 (P1.21) Data 57 Pin 40 (P1.22) Data 68 Pin 36 (P1.23) Data 79 Pin 13 (P0.28) RS10 Pin 14 (P0.29) EN11 GND WR

Page 8: Embedded System

PROCEDURE:

1. Connect 9 V power supply to the OASIS TRITON BOARD.

2. Connect the Board with the COM port of the PC using serial cable.

3. Generate.hex file using Triton IDE.

4. Put the board in ISP mode and give reset.

5. Download the .hex file.

6. Put the board RUN mode give reset.

Algorithm:

Program:

Output: string will be displayed on LCD.

Conclusion:

Experiment no: 3

Page 9: Embedded System

Objective: Write basic C- programs for 7 segment display interfacing.

Program Description: This programs demonstrate General Purpose Input Output by displaying 0 to 9 numbers and A to H alphabets.

Part List:

1. OASIS ARM7 BOARD.

2. RS232 Serial cable

3.9 Volt DC Power supply.

4. Triton IDE

Theory:

Seven segment display: Seven segment displays generally used as numerical indicators and consists of a no. of LED’s arranged in 7 segments as shown in figure. Any no. between 0 to 9 can be indicated by lightening the appropriate segments

The 7 seg. Are labeled a to g and dot as ‘.’. by forward biasing different LED

Segments, we can display the digits 0 through 9 and alphabets like A,b,C,d,E,F,H etc.

Seven segment display are of two types

comman cathode type

comman anode type.

We have used comman cathode type 7 seg. Display. The addresses generated are as given below

Number or

‘.’ ‘g’ ‘f’ ‘e’ ‘d’ ‘c’ ‘b’ ‘a’ Address Generated

Page 10: Embedded System

Alphabet

0 0 0 1 1 1 1 1 1 3F

1 0 0 0 0 0 1 1 0 06

2 0 1 0 1 1 0 1 1 5B

3 0 1 0 0 1 1 1 1 4F

4 0 1 1 0 0 1 1 0 66

5 0 1 1 0 1 1 0 1 6D

6 0 1 1 1 1 1 0 1 7D

7 0 0 0 0 0 1 1 1 07

8 0 1 1 1 1 1 1 1 7F

9 0 1 1 0 1 1 1 1 6F

A 0 1 1 1 0 1 1 1 77

b 0 1 1 1 1 1 0 0 7C

C 0 0 1 1 1 1 0 1 3D

d 0 1 0 0 1 1 1 0 5E

E 0 1 1 1 1 0 0 1 79

F 0 1 1 1 0 0 0 1 71

H 0 1 1 1 0 1 1 0 76

. 1 0 0 0 0 0 0 0 80

Now about the hardware interfacing

Page 11: Embedded System

Seven Segment Display Interface (Switch S6 2-3 closed)The following table lists details about the LCD display interface with the tritan board.

Sr.No Signal(LPC21xx)

Description7 Seg. Display

1 Pin 16 (P1.16) ‘a’2 Pin 12(P1.17) ‘b’3 Pin 8 (P1.18) ‘c’4 Pin 4 (P1.19) ‘d’5 Pin 48 (P1.20) ‘e’6 Pin 44 (P1.21) ‘f’7 Pin 40 (P1.22) ‘g’8 Pin 36 (P1.23) ‘.’9 Pin 13 (P0.28) NC10 Pin 14 (P0.29) NC11 GND NC

Seven Segment Display Interfacing:

PROCEDURE:

Page 12: Embedded System

1. Connect 9 V power supply to the OASIS TRITON BOARD.

2. Connect the Board with the COM port of the PC using serial cable.

3. Generate.hex file using Triton IDE.

4. Put the board in ISP mode and give reset.

5. Download the .hex file.

6. Put the board RUN mode give reset.

Algorithm:

Program:

Output: Numbers and alphabets are displayed on the 7 seg. Display .

Conclusion:

Experiment no: 4

Page 13: Embedded System

Objective: Interface RTC and display on HyperTerminal continuously

Program Description: This program demonstrates on chip RTC using c language.

Part List:

1. OASIS ARM7 BOARD.

2. RS232 Serial cable

3.9 Volt DC Power supply.

4. Triton IDE

Theory:

1. Features of RTC

• Measures the passage of time to maintain a calendar and clock.• Ultra Low Power design to support battery powered systems.• Provides Seconds, Minutes, Hours, Day of Month, Month, Year, Day of Week, and Day of Year.• Dedicated 32 kHz oscillator or programmable prescaler from APB clock.• Dedicated power supply pin can be connected to a battery or to the main 3.3 V.

2. Description

The Real Time Clock (RTC) is a set of counters for measuring time when system power is on, and optionally when it is off. It uses little power in Power-down mode. On the LPC2141/2/4/6/8, the RTC can be clocked by a separate 32.768 KHz oscillator, or by programmable prescale divider based on the APB clock. Also, the RTC is powered by its own power supply pin, VBAT, which can be connected to a battery or to the same 3.3 V supply used by the rest of the device.

The RTC includes a number of registers. The address space is split into four sections by functionality. The first eight addresses are the Miscellaneous Register GroupThe second set of eight locations is the Time Counter Group The third set of eight locations contains the Alarm Register Group The remaining registers control the Reference Clock Divider.

Page 14: Embedded System

. The Real Time Clock includes the register shown in Detailed descriptions of the registers follow.

Name Size Description Access Address

ILR 2 Interrupt Location Register R/W 0xE002 4000

CTC 15 Clock Tick Counter RO 0xE002 4004

CCR 4 Clock Control Register R/W 0xE002 4008

SEC 6 Seconds Counter R/W 0xE002 4020

MIN 6 Minutes Register R/W 0xE002 4024

HOUR 5 Hours Register R/W 0xE002 4028

Page 15: Embedded System

Interrupt Location Register (ILR - 0xE002 4000)

The Interrupt Location Register is a 2-bit register that specifies which blocks aregenerating an interrupt Writing a one to the appropriate bit clears thecorresponding interrupt. Writing a zero has no effect. This allows the programmer to read this register and write back the same value to clear only the interrupt that is detected by the read.

Interrupt Location Register (ILR - address 0xE002 4000) bit description

Bit Symbol Description

0 RTCCIF When one, the Counter Increment Interrupt blockgenerated an interrupt.

Writing a one to this bit location clears the counter increment interrupt.

0 RTCALF When one, the alarm registers generated an interrupt. Writing a one to

this bit location clears the alarm interrupt.

7:2 ---- Reserved, user software should not write ones to reserved bits. The

value read from a reserved bit is not defined.

Clock Tick Counter Register (CTCR - 0xE002 4004)The Clock Tick Counter is read only. It can be reset to zero through the Clock ControlRegister (CCR). The CTC consists of the bits of the clock divider counter.

Clock Tick Counter Register (CTCR - address 0xE002 4004) bit description

Bit Symbol Description

14:0 Clock TickCounter

Prior to the Seconds counter, the CTC counts 32,768 clocks persecond. Due to the RTC Prescaler, these 32,768 time increments may not all be of the same duration..

15 ---- Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined.

Clock Control Register (CCR - 0xE002 4008)The clock register is a 5-bit register that controls the operation of the clock divide circuit.Each bit of the clock register is described below

Page 16: Embedded System

Bit Symbol Description0 CLKEN Clock Enable. When this bit is a one the time counters

are enabled. When it is a zero, they are disabled so that they may be initialized.

1 CTCRST CTC Reset. When one, the elements in the Clock Tick Counter are reset. The elements remain reset until CCR[1] is changed to zero.

3:2 CTTEST Test Enable. These bits should always be zero during normal operation.

4 CLKSRC . If this bit is 0, the Clock Tick Counter takes its clock from the Prescaler, as on earlier devices in the Philips Embedded ARM family. If this bit is 1, the CTC takes its clock from the 32 kHz oscillator that’s connected tothe RTCX1 and RTCX2 pins

7:5 ------ Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined

Consolidated Time register 0 (CTIME0 - 0xE002 4014)The Consolidated Time Register 0 contains the low order time values: Seconds, Minutes, Hours, and Day of Week.

Consolidated Time register 0 (CTIME0 - address 0xE002 4014) bit description

Bit Symbol Description5:0 Seconds Seconds value in the range of 0 to 597:6 Reserved, user software should not write ones

to reserved bits. The value read from a reserved bit is not defined.

13:8 Minutes Minutes value in the range of 0 to 5915:14 Reserved, user software should not write ones

to reserved bits.The value read from a reserved bit is not defined.

20:16 Hours Hours value in the range of 0 to 2323:21 Reserved, user software should not write ones

to reserved bits.The value read from a reserved bit is not defined.

26:24 Day Of Week

Day of week value in the range of 0 to 6

31:27 ------ Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not defined.

Page 17: Embedded System

RTC external 32 kHz oscillator component selectionThe RTC external oscillator circuit is shown in Figure. Since the feedbackresistance is integrated on chip, only a crystal, the capacitances CX1 and CX2 need to be connected externally to the microcontroller.

CL is the typical load capacitance of the crystal and is usually specified by the crystal manufacturer. The actual CL influences oscillation frequency. When using a crystal that is manufactured for a different load capacitance, the circuit will oscillate at a slightly different frequency (depending on the quality of the crystal) compared to the specified one.

Page 18: Embedded System

PROCEDURE:

1. Connect 9 V power supply to the OASIS TRITON BOARD.

2. Connect the Board with the COM port of the PC using serial cable.

3. Generate.hex file using Triton IDE.

4. Put the board in ISP mode and give reset.

5. Download the .hex file.

6. Put the board RUN mode give reset.

Algorithm:

Program:

Output: RTC o/p will be displayed on HyperTerminal.

Conclusion:

Page 19: Embedded System

EXPERIMENT NO: 5

Objective: Write a program to demonstrate UART operation.

Program Description: This program Demonstrates UART operation by sending some characters on TxD0.Part List:1. OASIS ARM7 (TITAN) BOARD2. RS232 Serial cable3. 9 Volt DC Power Supply4. Triton IDE

Theory:LPC2148 consist of two UARTs among which we are using UART0 for our practical

Universal Asynchronous Receiver/Transmitter 0 (UART0)

Architecture of UART0The architecture of the UART0 is shown below in the block diagram. The VPB interface provides a communications link between the CPU or host and the UART0. The UART0 receiver block, U0RX, monitors the serial input line, RXD0, for valid input. TheUART0 RX Shift Register (U0RSR) accepts valid characters via RXD0. After a valid character is assembled in the U0RSR, it is passed to the UART0 RX Buffer Register FIFO to await access by the CPU or host via the generic host interface. The UART0 transmitter block, U0TX, accepts data written by the CPU or host and buffers the data in the UART0 TX Holding Register FIFO (U0THR). The UART0 TX Shift Register (U0TSR) reads the data stored in the U0THR and assembles the data to transmit via the serial output pin, TXD0.The UART0 Baud Rate Generator block, U0BRG, generates the timing enables used bythe UART0 TX block. The U0BRG clock input source is the VPB clock (PCLK). The main clock is divided down per the divisor specified in the U0DLL and U0DLM registers. This divided down clock is a 16x oversample clock, NBAUDOUT. The interrupt interface contains registers U0IER and U0IIR. The interrupt interface receives several one clock wide enables from the U0TX and U0RX blocks. Status information from the U0TX and U0RX is stored in the U0LSR. Control information for the U0TX and U0RX is stored in the U0LCR. Features• 16 byte Receive and Transmit FIFOs• Register locations conform to ‘550 industry standard.• Receiver FIFO trigger points at 1, 4, 8, and 14 bytes.• Built-in fractional baud rate generator with autobauding capabilities.• Mechanism that enables software and hardware flow control implementation.

Pin descriptionPin Type Description

Page 20: Embedded System

RXD0 Input Serial Input. Serial receive data.TXD0 Output Serial Output. Serial transmit data.

Register descriptionUART0 Transmit Holding Register (U0THR - 0xE000 C000, when DLAB = 0) The U0THR is the top byte of the UART0 TX FIFO. The top byte is the newest character in the TX FIFO and can be written via the bus interface. The LSB represents the first bit to transmit. The Divisor Latch Access Bit (DLAB) in U0LCR must be zero in order to access the U0THR. The U0THR is always Write Only.Bit Symbol Description7:0 THR Writing to the UART0 Transmit Holding Register causes the data

to be stored in the UART0 transmit FIFO. The byte will be sent when

Page 21: Embedded System

it reaches the bottom of the FIFO and the transmitter is available

UART0 Divisor Latch Registers (U0DLL - 0xE000 C000 and U0DLM -0xE000 C004, when DLAB = 1)The UART0 Divisor Latch is part of the UART0 Fractional Baud Rate Generator and holds the value used to divide the clock supplied by the fractional prescaler in order to produce the baud rate clock, which must be 16x the desired baud rate (Equation 1). The U0DLL and U0DLM registers together form a 16 bit divisor where U0DLL contains the lower 8 bits of the divisor and U0DLM contains the higher 8 bits of the divisor. A 0x0000 value is treated like a 0x0001 value as division by zero is not allowed.The Divisor Latch Access Bit (DLAB) in U0LCR must be one in order to access the UART0 Divisor Latches.Bit Symbol Description7:0 DLL The UART0 Divisor Latch LSB Register, along with the U0DLM

register, determines the baud rate of the UART0.

Bit Symbol Description7:0 DLM The UART0 Divisor Latch MSB Register, along with the U0DLL

register, determines the baud rate of the UART0.

UART0 Line Control Register (U0LCR - 0xE000 C00C)The U0LCR determines the format of the data character that is to be transmitted orreceived.Bit Symbol Value Description1:0 Word

LengthSelect

00011011

5 bit character length 6 bit character length7 bit character length 8 bit character length

2 Stop Bit Select

01

1 stop bit. 2 stop bits (1.5 if U0LCR [1:0] =00).

3 Parity Enable

01

Disable parity generation and checking. 01 Enable parity generation and checking.

5:4 Parity Select

00

01

1011

Odd parity. Number of 1s in the transmitted character and the attached parity bit will be odd. Even Parity. Number of 1s in the transmitted character and the attached parity bit will be even.Forced "1" stick parity. Forced "0" stick parity.

6 Break Control

01

Disable break transmission. Enable break transmission. Output pin UART0 TXD is forced to logic 0 when U0LCR [6] is active high.

7 Divisor Latch

Access Bit (DLAB)

01

Disable access to Divisor Latches. Enable access to Divisor Latches.

Page 22: Embedded System

Pin Assignment:7The Titan Board has a single console serial port with a DB-9 line interface. This port can be connected to a host system using a serial cable (1:1) through the DB-9 connector which is referred to as COM1 (UART0) on the board.

Procedure:1. Connect 9 V DC Power supply to the OASIS TITAN Board.2. Connect the Board with the COM port of the PC using the serial cable.3. Generate .hex file using Triton IDE.4. Put the board in ISP mode and give reset.5. Download the .hex file.6. Put the board in RUN mode and give reset.

Algorithm:

Program:

Output: Serially transmission of characters can be seen on HyperTerminal.

Conclusion

Page 23: Embedded System

EXPERIMENT NO: 6

Objective: Write a C program for external interrupts.

Program Description: This program Demonstrates External Interrupt by ISR handling.

Part List :1. OASIS ARM7 (TITAN) BOARD2. RS232 Serial cable3. 9 Volt DC Power Supply4. Triton IDE

Theory:Vectored Interrupt Controller (VIC)Features• ARM PrimeCell Vectored Interrupt Controller• 32 interrupt request inputs• 16 vectored IRQ interrupts• 16 priority levels dynamically assigned to interrupt requests• Software interrupt generationDescriptionThe Vectored Interrupt Controller (VIC) takes 32 interrupt request inputs andprogrammably assigns them into 3 categories, FIQ, vectored IRQ, and non-vectored IRQ.The programmable assignment scheme means that priorities of interrupts from thevarious peripherals can be dynamically assigned and adjusted.Fast Interrupt reQuest (FIQ) requests have the highest priority. If more than one request isassigned to FIQ, the VIC ORs the requests to produce the FIQ signal to the ARMprocessor. The fastest possible FIQ latency is achieved when only one request isclassified as FIQ, because then the FIQ service routine can simply start dealing with thatdevice. But if more than one request is assigned to the FIQ class, the FIQ service routine can read a word from the VIC that identifies which FIQ source(s) is (are) requesting aninterrupt.Vectored IRQs have the middle priority, but only 16 of the 32 requests can be assigned to this category. Any of the 32 requests can be assigned to any of the 16 vectored IRQ slots, among which slot 0 has the highest priority and slot 15 has the lowest. Non-vectored IRQs have the lowest priority. The VIC ORs the requests from all the vectored and non-vectored IRQs to produce the IRQ signal to the ARM processor. The IRQ service routine can start by reading a register from the VIC and jumping there. If any of the vectored IRQs are requesting, the VIC provides the address of the highest-priority requesting IRQs service routine, otherwise it provides the address of a default routine that is shared by all the non-vectored IRQs. The default routine can read another VIC register to see what IRQs are active. All registers in the VIC are word registers. Byte and halfword reads and write are not supported.

Page 24: Embedded System

Register descriptionThe following section describes the VIC registers in the order in which they are used in the VIC logic, from those closest to the interrupt request inputs to those most abstracted for use by software. For most people, this is also the best order to read about the registers when learning the VIC.

Name Description Access AddressVICIntEnable Interrupt Enable Register. This register

controls which of the 32 interrupt requests and software interrupts are enabled to contribute to FIQ or IRQ.

R/W 0xFFFF F010

VICVectAddr0 Vector address 0 register. Vector Address Registers 0-15 hold the addresses of the Interrupt Service routines (ISRs) for the 16 vectored IRQ slots.

R/W 0xFFFF F100

VICVectCntl0 Vector control 0 register. Vector Control Registers 0-15 each control one of the 16 vectored IRQ slots. Slot 0 has thehighest priority and slot 15 the lowest.

R/W 0xFFFF F200

Interrupt Enable register (VICIntEnable - 0xFFFF F010)This is a read/write accessible register. This register controls which of the 32 interruptrequests and software interrupts contribute to FIQ or IRQ.

Page 25: Embedded System

Interrupt Enable register (VICIntEnable - address 0xFFFF F010) bit description

Bit Symbol Description31:0 VICIntEnable When this register is read, 1s indicate interrupt requests

or software interrupts that are enabled to contribute to FIQ or IRQ.When this register is written, ones enable interrupt requests or software interrupts to contribute to FIQ or IRQ, zeroes have no effect

Vector Address registers 0-15 (VICVectAddr0-15 - 0xFFFF F100-13C)These are a read/write accessible registers. These registers hold the addresses of theInterrupt Service routines (ISRs) for the 16 vectored IRQ slots.Bit Symbol Description31:0 IRQ_vector When one or more interrupt request or software interrupt

is (are) enabled, classified as IRQ, asserted, and assigned to an enabled vectored IRQ slot, the value from this register for the highest-priority such slot will be provided when the IRQ service routine reads the Vector Address register -VICVectAddr

Procedure:1. Connect 9 V DC Power supply to the OASIS TITAN Board.2. Connect the Board with the COM port of the PC using the serial cable.3. Generate .hex file using Triton IDE.4. Put the board in ISP mode and give reset.5. Download the .hex file.6. Put the board in RUN mode and give reset.

Algorithm:

Program:

Output: Occurrence of interrupt will be displayed HyperTerminal.

Conclusion

Page 26: Embedded System

EXPERIMENT NO: 7

Objective: To write a program for the microcontroller for low power modes.

Program Description: This program demonstrates LPM of microcontroller using power control register.

Part List :1. OASIS ARM7 (TITAN) BOARD2. RS232 Serial cable3. 9 Volt DC Power Supply4. Triton IDE

Theory: Power controlThe LPC2141/2/4/6/8 supports two reduced power modes: Idle mode and Power-downmode. In Idle mode, execution of instructions is suspended until either a Reset or interrupt occurs. Peripheral functions continue operation during Idle mode and may generate interrupts to cause the processor to resume execution. Idle mode eliminates power used by the processor itself, memory systems and related controllers, and internal buses. In Power-down mode, the oscillator is shut down and the chip receives no internal clocks. The processor state and registers, peripheral registers, and internal SRAM values are preserved throughout Power-down mode and the logic levels of chip pins remain static. The Power-down mode can be terminated and normal operation resumed by either a Reset or certain specific interrupts that are able to function without clocks. Since all dynamic operation of the chip is suspended, Power-down mode reduces chip power consumption to nearly zero. Entry to Power-down and Idle modes must be coordinated with program execution. Wakeup from Power-down or Idle modes via an interrupt resumes program execution in such a way that no instructions are lost, incomplete, or repeated. A Power Control for Peripherals feature allows individual peripherals to be turned off if they are not needed in the application, resulting in additional power savings.

Register descriptionPower Control register (PCON - 0xE01F C0C0)The PCON register contains two bits. Writing a one to the corresponding bit causes entryto either the Power-down or Idle mode. If both bits are set, Power-down mode is entered.

Page 27: Embedded System

Power Control register (PCON - address 0xE01F C0C0) bit description

Page 28: Embedded System

Procedure:1. Connect 9 V DC Power supply to the OASIS TITAN Board.2. Connect the Board with the COM port of the PC using the serial cable.3. Generate .hex file using Triton IDE.4. Put the board in ISP mode and give reset.5. Download the .hex file.6. Put the board in RUN mode and give reset.

Algorithm:

Program:

Output: LED's will not blink in Power down and Idle mode but it will blink when Power down / Idle mode is OFF.

Conclusion