Lab 4 Solution

$30.00 $24.00

1) PB0 and PB1 each connect to an LED, and PB0’s LED is initially on. Pressing a button connected to PA0 turns off PB0’s LED and turns on PB1’s LED, staying that way after button release. Pressing the button again turns off PB1’s LED and turns on PB0’s LED. 2) Buttons are connected to PA0…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)

1) PB0 and PB1 each connect to an LED, and PB0’s LED is initially on. Pressing a button connected to PA0 turns off PB0’s LED and turns on PB1’s LED, staying that way after button release. Pressing the button again turns off PB1’s LED and turns on PB0’s LED.

2) Buttons are connected to PA0 and PA1. Output for PORTC is initially 7. Pressing PA0 increments PORTC once (stopping at 9). Pressing PA1 decrements PORTC once (stopping at 0). If both buttons are depressed (even if not initially simultaneously), PORTC resets to 0.

3) A household has a digital combination deadbolt lock system on the doorway. The system has buttons on a keypad. Button ‘X’ connects to PA0, ‘Y’ to PA1, and ‘#’ to PA2. Pressing and releasing ‘#’, then pressing ‘Y’, should unlock the door by setting PB0 to 1. Any other sequence fails to unlock. Pressing a button from inside the house (PA7) locks the door (PB0=0). For debugging purposes, give each state a number, and always write the current state to PORTC (consider using the enum state variable). Also, be sure to check that only one button is pressed at a time.

4) **(Challenge)** Extend the above door so that it can also be locked by entering the earlier code.

5) **(Challenge)** Extend the above door to require the 4-button sequence #-X-Y-X rather than the earlier 2-button sequence. To avoid excessive states, store the correct button sequence in an array, and use a looping SM.

Lab 4 Solution
$30.00 $24.00