CENG2400 Revision Q1a A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module. Two on/off switches are connected to bit-3.

Slides:



Advertisements
Similar presentations
Parul Polytechnic Institute
Advertisements

1 ARM Movement Instructions u MOV Rd, ; updates N, Z, C Rd = u MVN Rd, ; Rd = 0xF..F EOR.
OUTPUT INTERFACE – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
Chapter 2 HARDWARE SUMMARY
8086.  The 8086 is Intel’s first 16-bit microprocessor  The 8086 can run at different clock speeds  Standard 8086 – 5 MHz  –10 MHz 
Processor System Architecture
Introduction of Holtek HT-46 series MCU
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
Coordinate Based Tracking System
ARM programmer’s model and assembler Embedded Systems Programming.
Topics covered: ARM Instruction Set Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
Railway Foundation Electronic, Electrical and Processor Engineering.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
Railway Foundation Electronic, Electrical and Processor Engineering.
The 8051 Microcontroller and Embedded Systems
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
Basic Architecture Lecture 15. In general, if the number of bits is n, then the number of different combinations of 0s and 1s that can be made is 2 n.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an overview of the CPU architecture.
USB Peripheral Controller John Jones 12/11/08 Embedded Systems Architecture.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
Input Interface – Microprocessor
AT91 C-startup. 2 For reasons of modularity and portability most application code for an embedded application is written in C The application entry point.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
MICROCONTROLLER INTERFACING WITH STEPPER MOTOR MADE BY: Pruthvirajsinh Jadeja ( ) COLLEGE:DIET BRANCH:EC.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Intel Xscale® Assembly Language and C. The Intel Xscale® Programmer’s Model (1) (We will not be using the Thumb instruction set.) Memory Formats –We will.
Revision questions CENG2400 v.14b 1 CENG2400 Revision, Question 1 A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module.
WATER LEVEL controller using 8051
COURSE OUTCOMES OF Microprocessor and programming
80C51 Block Diagram ECE Overview.
The 8085 Microprocessor Architecture
Microprocessor and Assembly Language
Microcontrollers & GPIO
Timer and Interrupts.
Refer to Chapter 5 in the reference book
UNIT – Microcontroller.
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
The Cortex-M3/m4 Embedded Systems: Cortex-M3/M4 Instruction Sets
EE 319K Introduction to Embedded Systems
IPCOWALA INSTITUTE OF ENGINEERING & TECHNOLOGY-DHARMAJ
The 8085 Microprocessor Architecture
DIGITAL CALCULATOR USING 8051
8086 Microprocessor.
Introduction of microprocessor
Chapter 4 Addressing modes
UNIT 5 TIMRERS/COUNTERS
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Introduction to Microprocessors and Microcontrollers
Architecture & Support Components
Introducing the PIC Mid-Range Family and the 16F84A
Unit – Microcontroller Tutorial Class - 2 ANITS College
Microcontroller Labs Lab 1 – The LED Test Mode Dr. Gregg Chapman
Important 8051 Features On chip oscillator 4K bytes ROM 128 bytes RAM
The 8085 Microprocessor Architecture
8051 Micro Controller.
Introduction to Microprocessor Programming
Overheads for Computers as Components 2nd ed.
Wireless Embedded Systems
Computer Organization and Assembly Language
Introduction to Assembly Chapter 2
Computer Operation 6/22/2019.
An Introduction to the ARM CORTEX M0+ Instructions
Presentation transcript:

CENG2400 Revision Q1a A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module. Two on/off switches are connected to bit-3 and bit-5 (inputs) of the GPIO. If two switches are both on, set the bit-4 (output) of the GPIO to 1, otherwise set it to 0. Other bits are don’t care. The pins of the processor are already set to GPIO mode by default after power up. Draw the circuit for interfacing the switches to the GPIO inputs. Revision CENG2400 v.7d

Q1b The following lines are included in a header file arm.h: /* General Purpose Input/Output (GPIO) */ #define IO0PIN (*((volatile unsigned long *) 0xE0028000)) // read inputs of GPIO bits #define IO0SET (*((volatile unsigned long *) 0xE0028004)) // set GPIO bits register #define IO0DIR (*((volatile unsigned long *) 0xE0028008)) //set GPIO direction , 0=in,1=out #define IO0CLR (*((volatile unsigned long *) 0xE002800C)) // clear GPIO bit register Write a C language program segment for this system. Revision CENG2400 v.7d

Q2 (a) Discuss how each of the following programming systems is supported by an ARM microcontroller. Describe the registers used and give at least one application for each one. Stack, System calls, Subroutine calls. (b) Discuss the operations of an external interrupt of a microcontroller. Revision CENG2400 v.7d

Q3 A signal S is shown below You are given a microcontroller (e.g. ARM7) system which is running at 3.3 Volts. The system has a timer running at 1 KHz and timer interrupt is available. The system is used to measure the timing widths (T1, T2) of the pulses, roughly depicted in the above diagram. And save their values (in ms) into integer variables X1, X2 for T1, T2 respectively. Discuss the circuit to interface this signal to the microcontroller system. Draw the hardware system block diagram. Discuss the peripheral devices involved and the input/output methods you use for measuring T1 and T2. Write the pseudo code of your program. T1 T2 Time=0 Voltage 5V Time 10 Seconds Signal S Revision CENG2400 v.7d

Q4 List 12 addresses and their data contents from “store2” (data is in little endian format in this machine). Referring to program X, fill in the blanks. Location N,Z,C,V R0 R1 R2 R3 Just after LOC1 Just after LOC2 (the first time LOC2 is executed) Just after LOC2 (the last time LOC2 is executed) Just after LOC3 Revision CENG2400 v.7d Bit N (negative), Z (zero), C (carry), V (overflow) are the bits in the status register CPSR.

Q4 ;----- program X (in ARM assembly language) begins ------------------------- AREA |.data|, DATA, READWRITE ; RAM data memory address is starting at 0x40000000 store2 DCD 0,0,0 align;------------------------------------------------------------- AREA |.text|, CODE, READONLY ; EXPORT __main __main MOV R0,#0 MOV R1,#0 MOV R2,#0 MOV R3,#0 LDR R0,=store2 LDR R1,=0x00030007 STR R1,[R0] STR R1,[R0,#8] LOC1 MOV R0,#0 MOV R2,#0x08 LOC2 ADD R3,#2 CMP R2,R3 LOC3 BNE LOC2 NOP ; no operation END;----- program ends------------------------- Revision CENG2400 v.7d

Q5A Referring to program P shown below, list the values of the items of Flag Z of cpsr. Registers r0, r1, r2, r3, r15. List the four addresses and their contents in hexadecimal format of the four address locations that hold the value of data1. (List each address and its content individually.) At each of the following execution stages. . The processor is using the little-endian data format. After the execution of the statement labelled “loc1”. After the execution of the first and second times of the statement labelled “loop”. At “exit”. Revision CENG2400 v.7d

;----- program P begins------- AREA |.data|, DATA, READWRITE Q5B ;----- program P begins------- AREA |.data|, DATA, READWRITE ; RAM data memory address is starting at 0x4000 0000 foo DCD 0,0 data1 DCD 0,0 align;---------------------------- ; User Initial Stack & Heap AREA |.text|, CODE, READONLY ; EXPORT __main __main mov r0,#0 ; mov r1,#0; ;-this is at 0x0000 0110 mov r2,#0 mov r3,#0 loc1 mov r0,#2 ldr r1,=data1 ldr r2,[r1] ldr r3,=0x12345678 loop add r3,#1 str r3,[r1] subs r0,#1 BNE loop exit END;----- Revision CENG2400 v.7d

Q6 Some registers of an ARM processor and their values are shown below. r13=0x4013 2300 r14=0x0000 9100 r15=0x0084 1180 r0=0x0000 0000 r1=0x0000 0001 r2=0x0000 0002 r3=0x0000 0003 Then, an instruction “STMEDr13!, {r0-r2,r14} “ is executed. After that is complete. List the values of r0,r1,r2,r3 and r13,r14,r15 . List the addresses and data (in hexadecimal) stored in the data memory locations that have been changed by the instruction. Write down the instruction that can restore the values back to r0,r1,r2 and r14. Revision CENG2400 v.7d

Q7 An embedded system has a General-Purpose-Input-Output (GPIO) peripheral device. The GPIO port has 32 bits, P31,P30,..,Pi,..,P1,P0. An LED is attached to bit 0 of the GPIO, and an on/off switch is connected to bit 31 of the GPIO. The other GPIO bits are inputs and used for other purposes. The LED requires 30mA to run and has 2 Volts potential drop across its terminals. The output current of the GPIO bit is 10mA. The power supply provided is 3.3Volts. The C-language functions for using the GPIO ports are: Setup_direction_gpio(gpio_dir); /* gpio_dir is a 32-bit variable, if bit i of gpio_dir is 1, Pi is an output bit; otherwise it is an input bit.*/ set_gpio( gpio_set); /* gpio_set is a 32-bit variable. If bit i of gpio_clear is 1, Pi of GPIO is set. If bit i of gpio_set is 0, it has no effect. */ clear_gpio( gpio_clear); /* gpio_clear is a 32-bit variable. If bit i of gpio_clear is 1, Pi of GPIO is cleared. If bit i of gpio_clear is 0, it has no effect. */ val_gpio = read_gpio( ); /* val_gpio is a 32-bit variable. After this function is executed, the current status of the GPIO will be saved into val_gpio. */ Revision CENG2400 v.7d

Q7 (continue) setup_timer_interrupt_1KHz(); /* setup the timer interrupt at 1000Hz. The name of the timer interrupt service routine is “void timer_isr( )”; Draw the interface circuit for interfacing the LED and the switch to the embedded system. Write the pseudo code (based on the above C functions) of the system of the following different cases. Provide details of what parameters should be passed to the above C functions. After reset, when the switch is on, the LED is turned on, otherwise it is turned off. After reset, the LED is flashing at a regular frequency: turning on for one second and then off for one second precisely. Revision CENG2400 v.7d

Q8 A universal asynchronous receiver/transmitter (UART) of an embedded system (running on a polling input/output mode, not interrupt mode) has the following registers. Status_reg (8-bit) : - If the transmitter is empty, bit4=1, otherwise this bit is 0. - If a valid data is received, bit7=1, otherwise this bit is 0. - The other bits are not used here. Send_buffer (8-bit) : - It is used for holding the data byte to be sent. Recieve_buffer (8-bit) : - It is used for holding the data byte that has been received. Write the pseudo code of a C-language function “sendbyte (schar);” that sends a char variable “schar” to the serial output. Write the pseudo code of a C-language function “rchar=getbyte ( );” that receives a char variable “rchar” from the serial input. Write the pseudo code of a C-language function “sendhex ( hexbyte);” that sends the two ASCII presentation bytes of the 8-bit hexadecimal number hexbyte to the serial output. Hints: ASCII code for 0, is 0x30, 3 is 0x33, A is 0x41, B is 0x42 etc. For example if hexbyte is 0x2B, you send 0x32 and 0x42 to the serial port). Discuss why the polling input/output mode is not efficient. Explain how the interrupt mode can be used to make input/output more efficient. Revision CENG2400 v.7d