Docsity

Switch Bouncing-Control of Embedded Systems-Lab Mannual, Exercises of Embedded Control Systems

Toggle sidebar
bg1
2
EXPERIMENT NO 7
IMPLIMENTATION OF SEQUENTIAL CIRCUIT LOGIC
USING PIC18F4520 AND THE ISSUE OF SWITCH
BOUNCING
1. Objectives
Having completed this experiment you will be able to:
1. Appreciate the ease with which digital sequential circuit logic can be implemented using
Micro-controllers
2. Recognize the degrading effects of the switch bouncing problem on the performance of
state-machine, and how to avoid them using software-implemented switch debouncing
2. Basic Information
In this experiment we learn how to implement combinational lock using micro-controller.
2.1 Operational requirements for the Combinational Lock
You are required to im plement the code for the proposed com binational lock. The lock consists
of four (4) switches, a RED LED to indicate an error in entering the code, a GREEN LED to
indicate that the system is ready for accepti ng the code from the user, and a YELLOW LED
which represents the solenoid of the actual locking mechanism.
In order to unlock, the user will have to pre ss three (3) designated switches in the correct
sequence, while the GREEN LED is ON. The system will accept inputs only when the GREEN
LED is lit, i.e. any buttons pressed while the GREEN LED is OFF are discarded.
If the user presses wrong switches or in wr ong sequence, the RED LED will lit indicating an
error in entering the code, the GREEN LED will be turned OFF at this tim e. The RED LED
should be turned ON only once all the three sw itches have been pressed. The RED LED will
remain ON (and GREEN LED OFF) for six (6) s econds; and the system will not respond to any
switches pressed during this tim e. On the expiry of this dead time, the RED LED will turn OFF
while the GREEN LED will lit indicating that the user can now try again.
Remember that the system m ust wait for pressi ng of all the three (3) switches, correct or
otherwise, before taking the appropriate ac tion, i.e. energizing the YELLOW LED on entering
the correct code or lighting the RED LED on erroneous entry.
docsity.com
pf3

Partial preview of the text

Download Switch Bouncing-Control of Embedded Systems-Lab Mannual and more Exercises Embedded Control Systems in PDF only on Docsity!

EXPERIMENT NO 7

IMPLIMENTATION OF SEQUENTIAL CIRCUIT LOGIC

USING PIC18F4520 AND THE ISSUE OF SWITCH

BOUNCING

1. Objectives

Having completed this experiment you will be able to:

  1. Appreciate the ease with which digital sequential circuit logic can be implemented using Micro-controllers
  2. Recognize the degrading effects of the switch bouncing problem on the performance of state-machine, and how to avoid them using software-implemented switch debouncing

2. Basic Information

In this experiment we learn how to implement combinational lock using micro-controller.

2.1 Operational requirements for the Combinational Lock

You are required to im plement the code for the proposed com binational lock. The lock consists of four (4) switches, a RED LED to indicate an error in entering the code, a GREEN LED to indicate that the system is ready for accepting the code from the user, and a YELLOW LED which represents the solenoid of the actual locking mechanism. In order to unlock, the user will have to press three (3) designated switches in the correct sequence, while the GREEN LED is ON. The system will accept inputs only when the GREEN LED is lit, i.e. any buttons pressed while the GREEN LED is OFF are discarded.

If the user presses wrong switches or in wrong sequence, the RED LED will lit indicating an error in entering the code, the GREEN LED will be turned OFF at this tim e. The RED LED should be turned ON only once all the three switches have been pressed. The RED LED will remain ON (and GREEN LED OFF) for six (6) seconds; and the system will not respond to any switches pressed during this tim e. On the expiry of this dead tim e, the RED LED will turn OFF while the GREEN LED will lit indicating that the user can now try again.

Remember that the system m ust wait for pressing of all the three (3) switches, correct or otherwise, before taking the appropriate action, i.e. energizing the YELLOW LED on entering the correct code or lighting the RED LED on erroneous entry.

2.2 State-Diagram of the lock:

Inputs from switches A, B, C, And Z Assume the correct sequence of button is C A B

Outputs States States are numbered as 1, 2, 3, …. R & G for LEDs Inputs labeled as I:ABCZ Y for Relay/Solenoid x -- indicates don’t care Outputs labeled as O:RGY Outputs are associated with

Assumption: At any time only one button is pressed