Docsity

Midterm Examination for Real-Time Embedded Systems - IU Vietnam National University HCMC, Assignments of Mathematics

Toggle sidebar
bg1
THE INTERNATINONAL UNIVERSITY (IU) – VIETNAM NATIONAL UNIVERSITY – HCMC
Midterm Examination
Date: 20/04/2020.
Duration: 3 days
Group Numer : 1
Student Name : … Đặng Chí Hào ……Student ID:……… EEEEIU15004 …………
Student Name : ……Nguyễn Bá Trình……Student ID:……EEEEIU16083………
Student Name : ……………………………Student ID:……………………………………
SUBJECT: Real-Time Embedded Systems
Dean of School of Electrical Engineering
Signature:
Full name: Dr. Mai Linh
Lecturer: Vo Minh Thanh
Signature:
Full name: Vo Minh Thanh
INTRODUCTIONS:
1. This is a bring home test exam.
2. You have 3 days to complete the exam.
I. Theory Questions (20 points)
Q1. What is Embedded System? Draw a typical block diagram of embedded system.
An embedded system is a product which is controlled by a computer inside it, but
whose overall function is not computing.
Block diagram:
pf3
pf4
pf5

Partial preview of the text

Download Midterm Examination for Real-Time Embedded Systems - IU Vietnam National University HCMC and more Assignments Mathematics in PDF only on Docsity!

THE INTERNATINONAL UNIVERSITY (IU) – VIETNAM NATIONAL UNIVERSITY – HCMC Midterm Examination Date: 20/04/2020. Duration: 3 days Group Numer : 1 Student Name : … Đặng Chí Hào …… Student ID: ……… EEEEIU15004 ………… Student Name : ……Nguyễn Bá Trình…… Student ID: ……EEEEIU16083……… Student Name : …………………………… Student ID: …………………………………… SUBJECT: Real-Time Embedded Systems Dean of School of Electrical Engineering Signature: Full name: Dr. Mai Linh Lecturer: Vo Minh Thanh Signature: Full name: Vo Minh Thanh INTRODUCTIONS:

  1. This is a bring home test exam.
  2. You have 3 days to complete the exam.

I. Theory Questions (20 points)

Q1. What is Embedded System? Draw a typical block diagram of embedded system.

 An embedded system is a product which is controlled by a computer inside it, but

whose overall function is not computing.

 Block diagram:

Q2. Draw the Unified Modeling Language (UML) activity diagram of the embedded system design process.

II. LPC1768 Questions (30 points)

Q4. Refer to LPC1768 datasheet, LPC 1768 Manual to answer briefly the functions of GPIO Registers for Port 1 (FIO1DIR, FIO1MASK, FIO1PIN, FIO1SET, and FIO1CLR). 1) FIODIR : This is the GPIO direction control register. Setting a bit to 0 in this register will configure the corresponding pin to be used as an Input while setting it to 1 will configure it as Output. 2) FIOMASK : This gives masking mechanism for any pin i.e. it is used for Pin access control. Setting a bit to 0 means that the corresponding pin will be affected by changes to other registers like FIOPIN, FIOSET, FIOCLR. Writing a 1 means that the corresponding pin won't be affected by other registers. 3) FIOPIN : This register can be used to Read or Write values directly to the pins. Regardless of the direction set for the particular pins it gives the current start of the GPIO pin when read. 4) FIOSET : It is used to drive an 'output configured pin to Logic 1 i.e HIGH. Writing Zero does NOT have any effect and hence it cannot be used to drive a pin to Logic 0 i.e LOW. For driving pins LOW FIOCLR is used which is explained below. 5) FIOCLR : It is used to drive an 'output' configured pin to Logic 0 i.e LOW. Writing Zero does NOT have any effect and hence it cannot be used to drive a pin to Logic 1. Q5. Suppose you are using LPC 1768 microcontroller, write a short C code to initiate Port 1 Pin 28 as output.

#include "lpc17xx.h"

int main(void){

LPC_GPIO1->FIODIR = (1<<28);

while (1) {

LPC_GPIO1->FIOSET |= (1<<28);

delay(0.5);

LPC_GPIO1->FIOCLR |= (1<<28);

delay(0.5);

Q6. Suppose you are using LPC 1768 microcontroller, write a short C code to initiate Port 2 Pin 6 as input.

#include "lpc17xx.h"

int main(void){

LPC_GPIO2->FIODIR &= ~(1<<6);

while (1) {

LPC_GPIO2->FIOSET |= (1<<6);

delay(0.5);

LPC_GPIO2->FIOCLR |= (1<<6);

delay(0.5);

Q7. Suppose you are using LPC 1768 microcontroller, write a function short C code to set (assign 1) and reset (assign 0) port 1 pin 28.

Set port 1 pin 28 : LPC_GPIO1->FIOSET |= (1<<28);

Clr port 1 pin 28 : LPC_GPIO1->FIOCLR |= (1<<28);

Q8. Suppose you are using LPC 1768 microcontroller, write a program to configure P0.2 as Input to interface with a button using internal pull-up resistor. P0.6 is configured as output and connected to LED. If Input for P0.2 is a 'Low' then set output for P0.6 is made High for 5 seconds and then made Low.

#include <lpc17xx.h>

void delay(void);

int main(void)

LPC_GPIO0->FIODIR &= ~((1<<2)) ;

LPC_GPIO0->FIODIR |= (1<<6);

while(1)

if( !(LPC_GPIO0->FIOPIN & (1<<2)) )

LPC_GPIO0->FIOSET |= (1<<6);

delay();

return 0;

void delay(void)

int count,i=0;

for(count=0; count < 5000000; count++)

i++;

  • A Report of The Project (theory, program code + comment on important instructions)
  • PowerPoint Presentation
  • Simulation Hardware Demonstration
  • Q&A