Activity No.
1
Setting-up and Programming Controllers
Course Code: CPE 006 Program:
Course Title: Microprocessor System Date Performed: 11-13-19
Section: EE42FB1 Date Submitted: 11-20-19
Name/s: Agbisit, Judiel Instructor: Engr. Hate
Benavice, Dennise Fae C.
Capito, Jomer
Moscosa, Donna Orque
Marbella, Rhinrome C.
1. Objective:
This activity aims to demonstrate the concept of programming a microprocessor based system.
Another aim of this activity is to introduce procedures in testing and identification of errors in a program.
2. Intended Learning Outcomes (ILOs):
• After completion of this activity the students should be able to:
– Write a functional program for a microprocessor based system
– Compile and Upload a processor source code
– Identify errors and Debug issues in a source code for LED control.
3. Discussion:
A microcontroller is a compact integrated circuit designed to govern a specific operation in
an embedded system. A typical microcontroller includes a processor, memory and input/output
(I/O) peripherals on a single chip.
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino
boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into
an output - activating a motor, turning on an LED, publishing something online.
4. Resources Needed:
1 Arduino
Arduino (Software)
1 USB cable
4 Led
4 100 ohm resistor
1 Set wires
1 Breadboard
1 DMM
5. Procedures:
Arduino Software Set-up
1. Open Arduino (Software)
2. Click Tools, choose “Arduino/Genuino Uno” in Board category.
3. Then, “AVRISP mkII” in Programmer.
4. Make sure to have this set-up when using Arduino Uno.
Activity 1
1. Connect Arduino Board into the computer using USB cable.
2. Make a connection of a 100 ohm resistor and a LED in series.
3. Supply it with “13” from the Board and then ground.
4. Make the LED blink with a delay of 1000mS through programming in the Arduino Software.
5. Click Upload.
Activity 2
1. Make a connection of two 100 ohm resistor and 2 LED in series.
2. Supply the first LED with “13” and the other with “12”.
3. Make the LEDs blink alternately with a delay of 1000mS through programming in the
Arduino Software.
4. Click Upload.
Activity 3
1. Make a connection of four 100 ohm resistor and 4 LED in series.
2. Supply the first LED with “13”, second with “12”, third with “11” and fourth with “10”.
3. Make the LEDs blink one by one as if counting the LEDs with a delay of 1000mS through
programming in the Arduino Software.
4. Click Upload.
6. Results
Blinking Light
Code:
Int x=13;
void setup() {
pinMode(x, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(x, HIGH);
delay(1000);
digitalWrite(y, LOW);
delay(1000);
}
Two blinking light
Code:
void setup() {
pinMode(x, OUTPUT);
pinMode(y, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(x, HIGH);
digitalWrite(y, LOW);
delay(1000);
digitalWrite(x, LOW);
digitalWrite(y, HIGH);
delay(1000);
}
Running Light
Code:
Int x = 13;
Int y = 12;
Int z = 11;
Int z1 = 10;
void setup() {
pinMode(x, OUTPUT);
pinMode(y, OUTPUT);
pinMode(z, OUTPUT);
pinMode(z1, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(x, LOW);
digitalWrite(y, LOW);
digitalWrite(z, LOW);
digitalWrite(z1, LOW);
delay(1000);
digitalWrite(x, HIGH);
digitalWrite(y, LOW);
digitalWrite(z, LOW);
digitalWrite(z1, LOW);
delay(1000);
digitalWrite(x, HIGH;
digitalWrite(y, HIGH);
digitalWrite(z, LOW);
digitalWrite(z1, LOW);
delay(1000);
digitalWrite(x, HIGH);
digitalWrite(y, HIGH);
digitalWrite(z, HIGH);
digitalWrite(z1, LOW);
delay(1000);
digitalWrite(x, HIGH);
digitalWrite(y, HIGH);
digitalWrite(z, HIGH);
digitalWrite(z1, HIGH);
delay(1000);
}
7. Observations:
In this activity, the first step is to set-up the settings of the software for coding and energize the Arduino
board using USB cord connected to the computer USB port. Upon doing the activity we encounter problem
on blinking two led’s one at a time. The two led’s has a delay when interchanging. To resolve the mistake
we check first the circuit diagram and there is no problem in the circuit. The last possible option is to check
the code that we input on the software and we find out that the code is incorrect. Below are the main code
we used to make the two led’s blinking one at a time : ( digitalWrite(x, HIGH); digitalWrite(y, LOW);
delay(1000); digitalWrite(x, LOW); digitalWrite(y, HIGH); delay(1000); )
8. Conclusions:
In todays activity, we used Arduino board to control different kinds of circuits. We learned the basic
coding as applied to Arduino that can be use as an automatic switching device. In addition, we learned how
to do troubleshooting if there is a mistake on the code that affect the design intent of the experiment.
9. References:
[Link]
[Link]
10. Assessment (Rubric for Laboratory Performance):