28123 Parallax Inc, 28123 Datasheet - Page 185

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28123

Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
The first command:
gets all the I/O pins (P8 through P15) ready to send the low signals. If they all send low
signals, it will turn all the LEDs in the 7-segment LED display off. If you wanted all the
I/O pins to send the high signal, you could use
The low signals will not actually be sent by the I/O pins until you use the
to change all the I/O pins from input to output. The command:
sets all I/O pins P8 through P15 to output. As soon as this command is executed, P8
through P15 all start sending the low signal. This is because the command
%00000000
set all the I/O pins to output, they started sending their low signals. You can also use
DIRH = %00000000
Figure 6-13 shows how to use the
to P8 through P15. A binary-1 is used to send a high signal, and a binary-0 is used to
send a low signal. This example displays the number three on the 7-segment LED
display:
OUTH = %00000000
DIRH = %11111111
'
OUTH = %11010110
What does % do? The % is used to tell the BASIC Stamp Editor that the number is a binary
number. For example, the binary number %00001100 is the same as the decimal number
12. As you will see in this activity, binary numbers can make many programming tasks
much easier.
Before I/O pins become outputs: Up until the I/O pins are changed from input to output,
they just listen for signals and update the
IN8
IN4
All BASIC Stamp I/O pins start out as inputs. This is called a “default”. You have to tell a
BASIC Stamp I/O pin to become an output before it starts sending a high or low signal. Both
the
output. Placing a 1 in the
was executed just before this
HIGH
,
were used for reading pushbuttons in Chapter #3.
IN9
BAFG.CDE
, up through
and
to change all the I/O pins back to inputs.
LOW
commands automatically change a BASIC Stamp I/O pin’s direction to
IN15
DIRH
OUTH
. These variables can be used the same way that
variable also makes one of the I/O pins an output.
variable to selectively send high and low signals
DIRH
OUTH = %11111111
INH
command. As soon as the
variable. This is the variable that contains
instead.
DIRH
DIRH
command
IN3
OUTH =
variable
and

Related parts for 28123