Vous êtes sur la page 1sur 13

Activity No.

1
SETTING UP AND PROGRAMMING CONTROLLERS
Course Code: CPE 006 Program: ECE
Course Title: Microprocessor Systems Date Performed:11/18/2019
Section:EC42FA1 Date Submitted:11/25/2019
Name/s: Depone, James Alexander M. Nietes, Angela Instructor: Engr. Cris G. Hate
Elnar, Hem Lock Pantalunan, Cindy C.
Geronimo, Frederick
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:
1. Write a functional program for a microprocessor-based system
2. Compile and Upload a processor source code
3. Identify errors and Debug issues in a source code for LED control
3. Discussion:
Fundamentally, programming is process of creating a set of instructions that tell how to perform and
accomplish a task. In our everyday life you’ve already programmed several devices such as your cell
phones. The term programming usually refers to high-level languages such as BASIC, C, C++, COBOL,
JAVA, FORTRAN, ADA and PASCAL.
Designing and implementing processor programs is different and more challenging than writing typical
workstation. Nowadays, people usually using a device where it is a microcontroller board where it is a
open-source hardware and software company, project and user community that designs and
manufactures single-board microcontrollers and microcontroller kits for building digital devices and it is
called Arduino Uno. The Arduino board designs use variety of microprocessors and controllers.
The boards of Arduino have different important parts that you should know and those are USB connector,
Power Port, Microcontroller, Analog input pins, Digital pins, Reset Switch, Crystal oscillator, and USB
interface chip these are important parts that you can see on the board. There is other parts of Arduino and
they usually called as Shields, Shields are pieces of hardware that you can mount on the Arduino to give
it purpose or extra capabilities. Shields example are Relay, LCD and etc.
Arduino Uno have a lot of advantages like it is an open-source and extensible hardware, where as a circuit
designer you can make your own version of the module also, Arduino is its library of examples present
inside the software or Arduino IDE and lastly it is very active in giving solution and codes.

4. Resources Needed:
4.1 Desktop Computer
4.2 Arduino Software
4.3 LEDs
4.4 Breadboard
4.5 Digital Multimeters
4.6 Arduino
4.7 Connecting Wires
4.8 Resistors
5. Procedures:

Activity 1 – Lighting LED with Arduino


1. Connect the Arduino to the computer using USB cable type and look for the Arduino
software on your desktop.
2. Start writing your code in the Sketch Writing Area.

3. In this activity, we are asked to light an LED with Arduino. For the source code, follow the
block diagram below.
4. After writing the source code, click the compile button from the toolbar to verify for any error
in the code.

5. Then, to upload your code to the Arduino click the upload button beside the compile button
in the toolbar.

6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.

Figure 1.

Activity 2 – Blinking LED with Arduino


1. Connect the Arduino to the computer using USB cable type and look for the Arduino
software on your desktop.
2. Start writing your code in the Sketch Writing Area.
3. In this activity, we are asked to blink an LED with Arduino. For the source code, follow the
block diagram below.

4. After writing the source code, click the compile button from the toolbar to verify for any error
in the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button
in the toolbar.
6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.

Figure 2.
Activity 3 – Running LED with Arduino
1. Connect the Arduino to the computer using USB cable type and look for the Arduino
software on your desktop.
2. Start writing your code in the Sketch Writing Area.
3. In this activity, we are asked to blink an LED with Arduino. For the source code, follow the
block diagram below.
4. After writing the source code, click the compile button from the toolbar to verify for any error
in the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button
in the toolbar.
6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.

6. Results

Activity 1 – Lighting LED with Arduino

Test Program :

void setup () {
pinMode (13, OUTPUT);

void loop () {
digitalWrite(13, HIGH);

Connection for Lighting LED


Actual Connection

Circuit Diagram for Lighting LED


Activity 2 – Blinking LED with Arduino

Test Program:

void setup () {
pinMode (13, OUTPUT);
}
void loop () {
digitalWrite(13, HIGH);
delay(1000);

digitalWrite(13, LOW);
delay(1000);
}

Connection for Blinkin LED


Actual Connection

Circuit Diagram for Blinking LED

Activity 3 – Running LED with Arduino

Test Program:

void setup () {
pinMode (13, OUTPUT);
pinMode (12, OUTPUT);
pinMode (11, OUTPUT);
pinMode (10, OUTPUT);
pinMode (9, OUTPUT);
pinMode (8, OUTPUT);
pinMode (7, OUTPUT);
pinMode (2, OUTPUT);
}

void loop () {
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
digitalWrite(2, LOW);
delay(500);

digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, HIGH);
digitalWrite(2, HIGH);
delay(500);
}

Connection for Running LEDs

Actual Connection
Circuit Diagram for running LEDs

TEST RESULTS
PIN NUMBER VOLTAGE (V) CURRENT (mA)

13 3.9 24
12 3.9 21
11 3.98 18.3
10 4.01 18.3
9 3.97 19.87
8 4.01 21.4
7 4.06 19.87
2 4.27 22.05

7. Observations:
In this experiment we use arduino uno to make running lights. we observed that to make the LED
blink it takes a few lines of code. The first thing we do is define a variable that will hold the number of the
pin that the LED is connected to, The second thing we need to do is configure as an output the pin
connected to the LED.Finally, we have to turn the LED on and off with the sketch's loop() function. We do
this with two calls to the digitalWrite() function, one with HIGH to turn the LED on and one with LOW to
turn the LED off. If we simply alternated calls to these two functions, the LED would turn on and off too
quickly for us to see, so we add two calls to delay() to slow things down. The delay function works with
milliseconds, so we pass it 100ms to pause for a second.
8. Conclusions:

In this activity, we learn how to make LED blink in arduino by uploading few codes. we therefore
conclude that the blinking LED is the first program we must learn in arduino because the blinking LED is
the "Hello World!" of pyhsical computing.

9. References:
https://makeradvisor.com/top-10-most-useful-arduino-shields/
https://en.wikipedia.org/wiki/Arduino_Uno#Background

10. Assessment (Rubric for Laboratory Performance):

Vous aimerez peut-être aussi