Vous êtes sur la page 1sur 7

Digital I/O with 7-Segment LED

By: John Muratore, Research Associate Professor, Aviation Systems and Flight Research, University of Tennessee Space Institute William Moonan, Graduate Research Assistant, Aviation Systems and Flight Research, University of Tennessee Space Institute Joseph Young, Graduate Research Assistant, Aviation Systems and Flight Research, University of Tennessee Space Institute

Common Cathode 7-Segment LEDs can be acquired from Radio Shack at http://www.radioshack.com/product/index.jsp?productId=2062557 Writing Digital Outputs 1. Connect the myDAQ unit to drive the 7 segment display. This requires connecting the digital ports on the myDAQ (labeled P0.0 thru P0.7) each through a 1 kiloohm resistor to the chip containing the 7 segment display per the following diagram (note only two channels are shown on the diagram). A connection table shows the assignment of myDAQ output channel lines to inputs to the 7 segment display. NOTE THAT ALL INPUTS TO THE 7 SEGMENT MUST GO THROUGH A RESISTOR FIRST!

myDAQ Connection 7 Segment Pin DIO0 DIO1 DIO2 DIO3 DIO4 DIO5 DIO6 DIO7 6 1 2 3 4 5 7 dp

5 7 5 gnd 7 4 4 3 3 2 6 1

6 1 gnd

dp 2

Now build a simple VI to write to the digital lines. With this VI if you click on any of the Boolean controls in the array, it will turn on or off one of the elements in the 7 segment display. Note that the Boolean array must be a CONTROL not an INDICATOR.

Once this is working successfully demonstrate it to your instructor. Then run the VI provided entitled 7 segment dio only.VI. Once you run this VI, every time you cycle the VI software switch up and down it will increment a counter which will be displayed in the 7 segment hardware on the protoboard via digital writes as well as the 7 segment display on the VI. Demonstrate this to your instructor.

In this more complex VI, we use a CASE statement to map a given counter state to the proper set of digital i/o writes to make the proper digit illuminate on the 7 segment display. The following truth table is implemented in the case statement.

Digit 0 1 2 3 4 5 6 7 8 9 A B C D E F

dp 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1

7 0 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1

5 1 0 0 0 1 1 1 0 1 1 1 1 1 0 1 1

4 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1

3 1 0 1 1 0 1 1 0 1 0 0 1 1 1 1 0

2 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0

1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0

6 1 0 1 1 0 1 1 1 1 1 1 0 1 0 1 1

Hex representation of 7 Segment code 3F 06 5B 4F 66 6D 7D 07 7F 67 F7 FC B9 DE F9 F1

AS 508 Lab 7 Digital I/O Name_______________________ Task 1 -555 Timer and DAQ Counter 1. 2. 3. 4. 5. what is predicted period_____ what is predicted frequency ____________ what is predicted duty cycle _____________ What is measured pulse count/unit time ________ What is measured frequency________________

Demo of simple count vi

Task 2 Demo of simple write Demo of 7 segment dio only.vi

Task 3 Demo of simple read Demo of advanced read and write