Transcript ppt.
Module 2 – Digital I/O
Output: Use the digital port to provide signals to display a number
on a seven segment light emitting display (LED) display by wiring
up the breadboard to connect it to the 8 port0 digital lines.
• Test this interface with a VI that lets you enter a number on the
front panel and then displays the number on the sevensegment LED. The VI should turn the LED’s off when it quits.
Input: Use the same portm in input mode, to read a binary pattern
created by setting the switches on a dual in-line package (DIP)
switch module, and mount the device on the breadboard and
connect it to the same 8 digital lines..
• Test this interface with another (or part of the previous) VI.
Physics 434
1
Notes on Module 2
•
Two VI’s, due next week.
– (Note that you can combine them into one, using a listbox or ring )
– TTL output logic levels: <0.4 V off, > 4.35 V on.
– Input: open means off, closed (connected to 5 V) on.
•
•
Use 8 300 current-limiting resistors.
Note that same 8 lines are output (part I) and input (part II).
– You can set up your breadboard to do both
•
You have to deal with binary numbers (table II is a worksheet)
– Note the Format & Precision menu item for a numeric constant, which can
be used to set binary (or octal or hexadecimal).
•
Note the requirement: your VI should turn the LED’s off when it
stops. (think about how to do it.)
Physics 434
2
Seven segment wiring (common cathode)
A
14
B
13
C
8
D
7
E
6
F
1
G
2
dp
9
Cath
4,12
DIPs (Dual-Inline-Packages) have an
orientation notch in one end. If the
chip is held so that the long axis is
horizontal and the notch is at the left
end, pin #1 is the leftmost pin in the
bottom row. Pins are numbered
counter-clockwise from there, i.e. left
to right across the bottom row, then
right to left across the top row. This
allows automated chip-insertion
machinery to ensure correct
orientation of the chip by mechanical
sensing. The picture is for a 8-pin
DIP.
In this case the “notch” is the top.
Physics 434
3
Wiring of the CAT5 pairs and 7-seg.
Data
Color
DAQ
hea
der
7-seg
pin
7-seg
name
P0.0
brown
65
1
14
A
P0.1
“/white
66
2
13
B
P0.2
orange
67
3
8
C
P0.3
“/white
68
4
7
D
P0.4
green
69
5
6
E
P0.5
“/white
70
6
1
F
P0.6
blue
71
7
2
G
P0.7
“/white
72
8
9
dec.pt
4 or 12
Cath.
Gnd
Physics 434
4
Notes on mapping
• How do you convert the numbers 1-9 to a different sequence?
In most languages, two choices:
– case or if-elseif (adds code, complexity)
– Table lookup (adds to memory)
• How does this map into G?
See the Demo VI.
Physics 434
5