CENG2400 RevisionQ1a: A system has an ARM processor with a 32-bitGeneral Purpose Input Output (GPIO) moduleTwo on/off switches are connected to bit-3 andbit-5 (inputs) of the GPIO. If two switches areboth on, set the bit-4 (output) of the GPiO to 1,otherwise set it to O. Other bits are don't careThe pins of the processor are already set toGPIO mode by default after power up- Draw the circuit for interfacing the switches to theGPIO inputs1RevisionCENG2400y.7d
Revision CENG2400 v.7d 1 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
Q1bThe following lines are included in a header filearm.h:/*GeneralPurposeInput/Output(GPIO)*#define IO00PIN (*((volatile unsigned long *) 0xE0028000))Il read inputs of GPIO bits#define IO0SET (*((volatile unsigned long *) 0xE0028004))Il set GPIO bitsregister#define 00DIR (*((volatile unsigned long *) 0xE0028008)l/setGPIO direction,O=in,1=out#define IO0CLR (*((volatile unsigned long *) 0xE002800C))Il clear GPIO bit registerWrite a C languageprogram segment for this system2RevisionCENG2400v.7d
Revision CENG2400 v.7d 2 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
Q2(a) Discuss how each of the followingprogramming systems is supported by an ARMmicrocontroller. Describe the registers usedand give at least one application for each oneStack,System calls,Subroutine calls(b) Discuss the operations of an externalinterrupt of a microcontroller.3RevisionCENG2400v.7d
Revision CENG2400 v.7d 3 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
Q3AsignalSisshownbelowYou are given a microcontroller (e.g. ARM7) system which is running at 3.3Volts. The system has a timer running at 1 KHz and timer interruptisavailable.Thesystemisusedtomeasurethetimingwidths(T1,T2)ofthepulses,roughly depicted in the above diagram. And save their values (in ms)into integer variables X1, X2 forT1, T2 respectively.· Discuss thecircuitto interface this signaltothe microcontrollersystem.Drawthehardwaresystemblockdiagram.Discusstheperipheraldevices involved andtheinput/outputmethodsyouuseformeasuring T1and T2..Write the pseudo code ofyour programVoltageSignal s5VTimeTime=0SecondsTT14RevisionCENG2400v.7d
Revision CENG2400 v.7d 4 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. • T 1 T 2 Time=0 Voltage 5V Time Seconds Signal S
List12addressesandtheirdataQ4contentsfrom"store2”(dataisinReferringtoprogramX, fill intheblankslittle endian format in this machine)R1R2R3LocationRON,Z,C,VJust afterLOC1Just afterLOC2 (thefirst timeLOC2 isexecuted)Just afterLOC2 (thelasttimeLOC2 isexecuted)Just afterLOC35RevisionCENG2400v.7dBitN (negative),Z(zero),C(carry),V (overflow)arethe bits inthe status register CPSR
Revision CENG2400 v.7d 5 Q4 • 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 Bit N (negative), Z (zero), C (carry), V (overflow) are the bits in the status register CPSR. List 12 addresses and their data contents from “store2” (data is in little endian format in this machine)