Microcontrollers and Interface Programming (CSCT6102)
Computer Science - COS
Semester: First Semester
Level: 500
Year: 2017
Page 1 of2
SCHOOL: H.T.T.T.C DEPARTEMENT: CS LECTURER(S): Dr. DADA Jean-Pierre
COURSE CODE: FUN511 COURSE TITLE: Microcontrollers interface programming and projects
OPTION: FCS 500 DATE: December ……., 2017 HALL: …….… TIME: 2 hrs NATURE: Exam
Instructions:……… Answer all questions………..
Exercise 1: This is a program with the electronic circuit done by a student:
#include <LiquidCrystal.h> // (1)
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int sensorPin = A0; // (2)
int ledPin = 13;
void setup() {
lcd.begin(20,4); // (3)
pinMode(ledPin, OUTPUT); // (4)
}
void loop() {
digitalWrite(ledPin, HIGH);
float sensorValue = 0;
sensorValue = analogRead(sensorPin); // (5)
sensorValue = sensorValue*66/136 ; // (6)
lcd.clear();
lcd.setCursor(0,0); // (7)
lcd.print("The voltage is:");
lcd.setCursor(0,2);
lcd.print(sensorValue); // (8)
lcd.setCursor(6,2);
lcd.print(" Milli-Volts"); // (9)
lcd.setCursor(4,3);
lcd.print("By. Dr. DADA"); // (10)
delay(5000); }
1) What programming software has been used to type
this program?
2) Give the role of the two functions used for this
program
3) List two differences on the functioning of the two
functions
4) Complete the circuit by wiring it so that it masters the
program
5) Explain the line codes (1); (2); (3); (4); (5); (6); (7);
(8); (9) and (10), listed on the program
6) When the program is written in that software, how can
we come up with the *.hex file?
7) Now that we have the *.hex file, how can we flash it in
the microcontroller using ISIS Proteus simulation software?
8) As the program is running, draw the message on the LCD
9) The program is now well working in ISIS software. Describe how the *.hex file could be flashed in
reality, in a microcontroller board bought at Bamenda central market?
REPUBLIC OF CAMEROON
Peace – Work – Fatherland
***********
THE UNIVERSITY OF BAMENDA
***********
HIGHER TECHNICAL TEACHER TRAINING
COLLEGE (H.T.T.T.C.) BAMBILI
***********
DIRECTORATE OF STUDIES
**********
P.O.BOX 39 BAMBILI
REPUBLIQUE DU CAMEROON
Paix – Travail - Patrie
***********
UNIVERSITE DE BAMENDA
***********
ECOLE NORMALE SUPERIEURE D’ENSEIGNEMENT
TECHNIQUE
***********
DIRECTION DES ETUDES
**********
Tél: 33 05 10 69
www.schoolfaqs.net
Page 2 of2
10) List at least 3 memories that we can fine in this type of microcontroller
11) Choose from those memories the one that stores the *.h file
12) Choose again the memory that stores data when the program is running.
13) What is the role of the LED for this project?
Exercise 2: Interfacing a refrigerator.
A refrigerator can use a microcontroller to control the temperature detected by a sensor. If the
temperature is higher than a fixed value, the heater moves heat and a diode shines. If this temperature is less
than the fixed value, the refrigerator sleeps.
1) Suggest a bloc diagram for this refrigerator.
2) Suggest a future refrigerator block diagram with “Welcome” and “Goodbye” messages displaying
when the refrigerator functions.
Exercise 3: Interfacing a GSM
1) Explain the line codes (1) … to…. (15), listed on the program and connect the circuit
#include <SoftwareSerial.h> // (1)
SoftwareSerial mySerial(9, 10); // (2)
void setup()
{
mySerial.begin(9600); // (3)
Serial.begin(9600); // (4)
delay(100); }
void loop(){
if (Serial.available()>0) // (5)
switch(Serial.read()) {
case 's':
SendMessage(); // (6)
break;
case 'r':
ReceiveMessage();
break; // (7)
}
if (mySerial.available()>0)
Serial.write(Serial.read()); // (8)
}
void SendMessage(){
mySerial.println("ok");
mySerial.println("AT+CMGF=1"); // (9)
delay(1000);
mySerial.println("AT+CMGS=\"+237699260124\"\r"); //(10)
delay(1000);
mySerial.println("Dr Dada has sent a message to you"); //(11)
delay(100); // (12)
mySerial.println((char)26); // (13)
delay(1000);
}
void ReceiveMessage(){
mySerial.println("AT+CNMI=2,2,0,0,0"); // (14)
delay(1000);
} // (15)
2) Explain the role of each function
3) For the simulation in ISIS Proteus, where do we flash the *.hex file of the program?
4) With the hardware bought at Commercial Avenue, Bamenda, where do we flash the *.hex file of the program?
3) What is the role of this entire program?
www.schoolfaqs.net