Starting from:

$30

CPE301-Lab 7 Debouncing, 7-Segements, EEPROM Solved

1.      Demonstrate methods for debouncing GPIO input.

2.      Demonstrate methods for driving parallel output.

3.      Demonstrate methods for storing non-volatile data in EEPROM memory.

Required Equipment:

1.      Arduino Mega 2560

2.      USB programming cable

3.      Laptop or Lab PC with Arduino IDE installed

4.      330 Ohm DIP Resistor

5.      7-Segment LED

6.      Push-button

7.      8-Bit Buffer (74LS373 or 74LS240 or 74LS244)

8.      Breadboard

9.      Jumper Kit

BEFORE THE LAB: Read the section on AVR memory in the 2560 datasheet starting on page 20.

Procedure:

1.      Connect a push-button and a 7-segment LED to you Arduino Mega 2560. 

a.      Wire the push button to be active low using the internal pullup resistor.

b.      Wire the 7-segment to a single GPIO port such that writing an 8 bit value to the port will result in a particular character being displayed on the 7-segment. Don’t forget to use a buffer chip to protect the GPIO port of your Arduino.

c.      Include in your report a table showing the 16 hex characters and the 16 byte values necessary to display the hex characters on the display as you wired it. 

d.      Include in your report a circuit diagram showing how you wired your circuit.

2.      Write a program to increment your 7-segment display by one character each time the button is pressed. 

a.      Write the program such that it rolls-over from F back to 0. 

b.      Make sure your program properly debounces the signal such that the display only increments once for each button press. 

c.      The code should not contain 16 if statements or switch statements. Write your code with efficiency and maintainability in mind, refer to the timer lab for hints.

d.      Write your program to use the 2560’s onboard EEPROM memory to retain the previous display position after a power cycle. 

i. For example, if the 7-segment is displaying ‘4’ before a power cycle, it should display ‘4’ when you power it back up. 

1
 ii. The program only needs to store one byte at a chosen address, and then read that byte back when the program starts. 

iii. Write a function which stores a byte at an address, and a function which returns a byte from an address.



f.       In your lab report, detail how your program works and what steps you took to build the circuit, write the program, and test each step along the way. This description should be written like a tutorial for someone else who wishes to build a similar system. 

More products