Você está na página 1de 5

Experiment 1: Output and Delay

Christopher L. Padua

I. Introduction In this experiment, output function


Microcontroller is an integrated determines which LEDs will light up.
circuit that is programmed for Different codes will be programmed
specific function or operation for an to show different output for the
embedded system. It is often found LEDs
in electronic devices and even in The second part of the experiment is
vehicles. the use of the Delay instruction as
In this experiment, Flowcode was shown in Figure 3, for the program
introduced which is a software for that was created in the first part of
programming a microcontroller PIC. the experiment. The Delay function
How to use the Flowcode software allows the user to slow down the
and the output and delay functions process of the PIC to enable the user
are the objectives of this to see the process because
experiment. microcontrollers executes
II. Methodology instructions at a very fast rate.

Figure 1: Flowcode Interface


Flowcode is an advanced integrated Figure 3: Delay Instruction
development environment (IDE) for III. Results and Discussion
system development for electronic Output:
and electromechanical system In steps 1 to 4 a decimal number
development targeting between 0-255 was used. A decimal
microcontrollers. input of 255 was used to light up all
The first part of the experiment is the LEDs on Port B as shown in
the use of the Output intructionn as Figure 4, 170 to only light up the odd
shown in Figure 2. LEDs on Port B as shown in Figure 5,
85 to only light up the even LEDs on
Port B as shown in Figure 6, and 240
to light up bits 4 to 7 as shown in
Figure 7.

Figure 2: Output Instruction


Figure 4 Figure 10

Figure 5 Figure 11
The next steps are putting LED ‘ON’
on PB7 by sending an 8-bit value as
shown in Figure 12, and by using the
‘Single bit’ output method as shown
in Figure 13.
Figure 6

Figure 12
Figure 7
The next step is repeating steps 1 to
4 using Hex notation. “0x” syntax is
used in order for the program to
recognize the entry in hexadecimal.
The result is shown in Figure 8 to 11. Figure 13
The other method to set the LED
‘ON’ is by the use of masking as
shown in Figure 14.

Figure 8

Figure 15
The last step in this activity is writing
a program with at least 20 Outputs
Figure 9 that writes different values to port B
by using 4 different methods
(Hexadecimal, Decimal, Single bit,
and Masking). The Results are
shown in Figure 16 to 19

Figure 16: Hexadecimal Figure 18: Single bit

Figure 17: Decimal Figure 19: Masking


Delay:
The first step in this experiment is
using ‘Delay’ for the program
created in the first part of the
experiment, the ‘Delay’ instruction
is used between the 20 ‘Output’
instructions in order to view the
different outputs even at HS Xtal
speeds. The result is shown in Figure
20.

Figure 21
the last step for the ‘Delay’
experiment, a program was created
where LEDs 0 to 7 will light up one by
one, then will turn all off and back on
and a delay instruction was used to
make the actual E-blocks viewable.
The result is shown in Figure 22.

Figure 20
The next step is using the same
exercise, a delay starting from 1 sec
and then shorter delay for each
step until it is to fast for the eyes to
detect 2 different LED outputs was
done as shown in Figure 21.

Figure 22
IV. Conclusion
In this experiment, the use of
Flowcode was introduced and
creating a program with the use of
‘Output’ and ‘Delay’ instructions.
The Flowcode enables the creation
of a basic switching LED that is
connected on the port B output of
the microcontroller. Different
output method was also introduced
such as decimal, hexadecimal, single
bit, and masking for different
outputs that will light up the LEDs.
For the use of hexadecimal, the
syntax ‘0x’ must be added on the
first value in order for it to be
recognized by the program. For the
‘Delay’ instruction, it allows the user
to observe the step by step flow of
the output of a program that was
created because microcontrollers
process data at a very fast rate that
makes it difficult to be observed.
V. Reference
• IoT Agenda. (2019). What is
microcontroller? - Definition
from WhatIs.com. [online]
Available at:
https://internetofthingsage
nda.techtarget.com/definiti
on/microcontroller
[Accessed 13 Jun. 2019].
• Matrixtsl.com. (2019).
Matrix - Flowcode 8 -
Flowchart Programming for
PIC and Arduino. [online]
Available at:
https://www.matrixtsl.com
/flowcode/ [Accessed 13
Jun. 2019].

Você também pode gostar