Activity No 1 - Setting Up and Programming Controllers-1
Activity No 1 - Setting Up and Programming Controllers-1
1
Setting up and Programming Controllers
Course Code:CPE006 Program:
Course Title: Microprocessor Systems Date Performed:
Section: Date Submitted:
Name/s: Instructor:
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.
3. Discussion :
In essence, the word programming means giving a mechanism the directions to accomplish a task. If you
are like most people, you’ve already programmed several mechanisms, such as your digital video recorder
(DVR), cell phone, or coffee maker. Like these devices, a computer also is a mechanism that can be
programmed. The directions (typically called instructions) given to a computer are called computer
programs or, more simply, programs.
Programmers use a variety of special languages, called programming languages, to communicate with the
computer. Some popular programming languages are C++, Visual Basic, C#, Java, and Python. In this
book, you will use the C++ programming language.
Designing and implementing processor programs is different and more challenging than writing typical
workstation or PC programs. The code must not only provide rich functionality, it must also often run at a
required rate to meet system deadlines, fit into the allowed amount of memory, and meet power
consumption requirements.
Designing code that simultaneously meets multiple design constraints is a considerable challenge, but
luckily there are techniques and tools that can be used to help through the design process. Making sure
that the program works is also a challenge, but once again methods and tools such as flowcharts and
pseudo codes simplify the algorithm writing procedures.
In mathematics, computer science, and related subjects, an algorithm is a finite sequence of steps
expressed for solving a problem. An algorithmcan be defined as “a process that performs some
sequence of operations in order to solve a given problem”. Algorithms are used for calculation, data
processing, and many other fields.
In computing, algorithms are essential because they serve as the systematic procedures that computers
require. A good algorithm is like using the right tool in the workshop. It does the job with the right amount
of effort.
4. Resources:
The activity will require the following software, tools and equipment:
4.1 Desktop Computer
4.2 Dev C/C++/Processing
4.3 Sketch/Flowcode
4.4 TinkerCAD
4.5 Other tools: __________________________________________________
5. Procedures:
1.Configure and connect the circuit to the microcomputer device. Each of the individual LED’s are
connected to a unique output pin as seen in the following block diagram. Draw the circuit diagram on the
Results section.
2.Test the function of each digital pin by turning ON all the LED’s in the system. Write the program in the
Results section.
3.Write a flowchart and program that controls the activity of LED bulbs. The program should be able to
perform the following, separately:
a.Turn on only the bits at the ODD position.
4.Write the source code in the space provided in the following section and include comments in the source
code.
5.Take note of possible bugs in the program. Cite your detections in the observations.
6.Using a Multimeter in TinkerCAD, test the operating voltages and currents of the microcontrollers’ pins.
Write the findings in the table provided in the following section.
6. Results
Circuit Diagram
Program 3B
Program 3C
Test Results
Pin Number Voltage when HIGH Voltage when LOW Remarks
1
2
3
4
5
6
7
8
Errors Detected
Error Solution
7. Observations
8. Conclusions
9. Supplementary Activity
Modify code 3B such that it is able to reverse its running light direction when it light ups the last LED in its
sequence, and then it will repeat itself. The running light should run from pin 0 to pin 13 with a delay of half
a second per LED.