31
When using the IO variable
on a single line, use the logic
state, either 0 or 1. When
using it on an entire group, use
the decimal equivalent, or
0 to 63 of the 6 bit number
represented by the group!
When addressing the I/O as a group, the LSB (Least Significant Bit) will be
line 1 of the group (e.g. 21, 31, 41, 51). The MSB (Most Significant Bit) will be
line 6 of the group (e.g. 26, 36, 46, 56).
This first exercise
will illustrate setting
the I/O as a group
using outputs. In the
second exercise a
short program is
used to set the I/O
group up as a binary
counter.
To perform these
exercises you will need
six (6) LED’s with
current limiting resis-
tors and a 9 volt battery or equiva-
lent +5 to +24VDC power supply.
It is possible to perform these
exercises without connecting
anything to the I/O, however, the
LED’s clearly show how the I/O is
being utilized as a group.
IO Variable Exercise #1
Setup your I/O group in accordance with the
figure 8.6. The pull-up switches on the
MicroLYNX should be ON.
The table on the left shows the bit weight of
each I/O line in the group. It also illustrates the
LED’s and their state that should appear when
entering the IO variables in this exercise.
Configure the IOS variable such that group 20 is
all general purpose outputs, active low or:
IOS 20 = 0,1,0
Enter the following in the terminal:
IO 20 = 35
As shown in the table, I/O lines 26, 22 and 21
should be illuminated and 25, 24 and 23 should
be off.
Enter this next:
IO 20 = 7
Now I/O 21, 22 and 23 should be illuminated.
IO 20 = 49
I/O 26, 25, and 21 are illuminated.
+
9V
Battery
V PULL
I/O 21
I/O 22
I/O 23
I/O 24
I/O 25
I/O 26
I/O GND
Figure 8.6: IO Variable Exercise Setup
111
000
BINARY STATE OF I/O GROUP 20
IO 20 = 35
I/O 21
LSB
I/O 26
MSB
I/O 22I/O 23I/O 24I/O 25
32
21
16 8
4
BIT WEIGHT DISTRIBUTION TABLE
FOR GROUP 20 I/O
I/O 21
LSB
I/O 26
MSB
I/O 22I/O 23I/O 24I/O 25
011
001
BINARY STATE OF I/O GROUP 20
IO 20 = 7
I/O 21
LSB
I/O 26
MSB
I/O 22I/O 23I/O 24I/O 25
101
100
BINARY STATE OF I/O GROUP 20
IO 20 = 49
I/O 21
LSB
I/O 26
MSB
I/O 22I/O 23I/O 24I/O 25
Table 8.1: Binary State of Outputs
Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.Downloaded from Arrow.com.