Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

10
Colegio De San Juan De Letran - Calamba Calamba City, Laguna School of Engineering MICRO 131L: Microprocessor Systems Lab Programming Basic I/O in Arduino MCU Board Laboratory Experiment No. 6 Grade Group Number : _________ Signature Group Leader : SN, FN MI _______________________ Members : SN, FN MI _______________________ SN, FN MI _______________________

description

CCCCCC

Transcript of Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

Page 1: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

Colegio De San Juan De Letran - CalambaCalamba City, Laguna

School of Engineering

MICRO 131L: Microprocessor Systems Lab

Programming Basic I/O in Arduino MCU Board Laboratory Experiment No. 6

Grade

Group Number : _________ Signature Group Leader : SN, FN MI _______________________ Members : SN, FN MI _______________________

SN, FN MI _______________________

Date Performed: ________________Date Submitted: ________________

Engr. Ricrey E. Marquez, CpE, MSCS(Lab Instructor)

OBJECTIVES AND MATERIALS

Page 2: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

Objectives:

1. To be familiar with Arduino board pin configurations and its functions.

2. To understand the how Arduino send and receive data from the output device.

3. To design and create an Arduino basic IO programs that are optimize as possible.

Materials:

Quantity Part Number Description1 - Universal MCU Trainer Kit1 - Gizduino Board1 - USB cable

1 set - Connecting wires

PROCEDURES

1. Consider the design application stated below, construct an Arduino-based IO circuit in Universal Microcontroller Trainer Kit for each applications. Draw and label each schematic diagram.

Page 3: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

2. Create and test basic IO Arduino sketch programs by uploading the firmware to the Gizduino MCU board (locally available Arduino-compatible board) connected to the IO circuit made in step 1.

3. Optimize your codes and avoid magic numbers. Observe the outputs and write the program code in data results.

Design Application No. 1 - 4 Alternate four LEDs

Create an Arduino Sketch program that lit LED sequence shown below for

20 times. Hint: Use looping statement for the number of iterations. (Filenames:

DesignApps1.ino, DesignApps1.h)

Figure 6.1. LED sequence of design application 1

Design Application No. 2 – 4-Bit Down-Count BCD Counter.

Create an Arduino Sketch program and test a 4-bit down-count similar to

the figure below. (Filenames: DesignApps2.ino, DesignApps2.h)

Figure 6.2 LED sequence of design application 2

Design Application No. 3 - Close-open LEDs

Create an Arduino Sketch that will lit LEDS shown below. Hint. Use array

variables for the LED patterns. (Filenames: DesignApps3.ino, DesignApps3.h)

Page 4: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

Figure 6.3. LED sequence of design application 3

Design Application No. 4 – Bi-directional 2-bit Shift Operation

Shifting two LEDs at a time from left to right. Hint: To have an optimize code, use

shift operators instead of using arrays for LED patterns. (Filenames: DesignApps4.ino,

DesignApps4.h)

Figure 6.4. LED sequence of design application 4

Design Application No. 5 – Seven Segment Sequence with Control Switch

Create an Arduino Sketch that will read push button switch, then will display

sequence of seven-segment display shown in the table below. Hint: Use array variable for

seven-segment display and temporary counter variable for push button pulse.

Page 5: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

(Filenames: DesignApps5.ino, DesignApps5.h)

NO. OF PULSE SEVEN-SEGMENT SEQUENCE0 0 – 1 – 2 – 3 – 4 – 5 – 6 – 7 – 8 – 9 – 0, then repeat1 1 – 3 – 5 – 7 – 9, then repeat2 9 – 8 – 7 – 6 – 5 – 4 – 3 – 2 – 1 - 0, then repeat3 0 – 2 – 4 – 6 – 8, then repeat

Other Set pulse 0

SCHEMATIC DIAGRAM

Page 6: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

Figure 6.1. Schematic diagram for design applications 1 to 4.

Figure 6.2. Schematic diagram for design application 5.

DATA RESULTS

Program Listing 1 – Code for design application 1

Program Listing 2 – Code for design application 2

Program Listing 3 – Code for design application 3

Page 7: Micro 131L Lab Experiment # 6 - Basic IO Programming in Arduino MCU Board

Program Listing 4 – Code for design application 4

Program Listing 5– Code for design application 5

GROUP CONCLUSION