Starting from:

$30

Lab #6 SOlution

Objective:




Build the circuit and write code to interact with a seven segment LED interfaced with the Arduino Mega SBC.







Procedure:




Using PK0-PK7 as outputs to the buffer and PB0-PB3 as inputs from the switch, build a seven segment LED interface using a 4-bit DIP switch, an 8-bit buffer, and a common-anode 7-segment LED as shown for the Intel 8051 microcontroller in (Figure 3.8 from MacKenzie) below. With this configuration, setting one of the PK.x pins HIGH turns its corresponding LED segment “ON.”






NOTE: We are using the Arduino Mega portB bits 0 through 3 instead of the 8051 P3.0-P3.3 as shown in the figure as inputs from the switch. Also, remember to tie each switch high through a resistor. We are using the Arduino Mega PortK bits 0 through 7 as outputs to the 74LS240 instead of P1.0-P1.7 as shown in the figure.




Write a program which polls a 4-bit binary code from the DIP switch and updates the LED display with the appropriate hexadecimal character. For example, if the code read is 1010 binary, then “A” should appear on the LED display (i.e. segments a through g respectively should be ON, ON, ON, OFF, ON, ON, and ON). The numbers which you should display are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, b, C, d, E, F (note the lower case b and d).






NOTE: ALL programs written for this course need to be documented in a complete manner which will make sense to you if you need to go back and review the program a year or two from now. You need to include your NAME and a revision number on ALL programs as well.

More products