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.
I O V a r i a b l e E x e r c i s e # 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.
+
9 V
B a tte ry
V P U L L
I/O 21
I/O 22
I/O 23
I/O 24
I/O 25
I/O 26
I/O G N D
Figure 8.6: IO Variable Exercise Setup
1
1
1
0
0
0
BIN A RY STAT E O F I/O G R O U P 20
IO 20 = 35
I/O 2 1
L S B
I/O 2 6
M S B
I/O 2 2
I/O 2 3
I/O 2 4
I/O 2 5
3 2
2
1
1 6
8
4
BIT W E IG H T D IS TR IB U TIO N TAB LE
F O R G R O U P 20 I/O
I/O 2 1
L S B
I/O 2 6
M S B
I/O 2 2
I/O 2 3
I/O 2 4
I/O 2 5
0
1
1
0
0
1
BIN A RY STAT E O F I/O G R O U P 20
IO 20 = 7
I/O 2 1
L S B
I/O 2 6
M S B
I/O 2 2
I/O 2 3
I/O 2 4
I/O 2 5
1
0
1
1
0
0
BIN A RY STAT E O F I/O G R O U P 20
IO 20 = 49
I/O 2 1
L S B
I/O 2 6
M S B
I/O 2 2
I/O 2 3
I/O 2 4
I/O 2 5
Table 8.1: Binary State of Outputs
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from