gates emulator using 8051

11
This project Digital gated Emulator This project Digital gated Emulator using Microcontroller is used to using Microcontroller is used to emulate the basic gates such us NOT, emulate the basic gates such us NOT, OR, AND. OR, AND. The system has the selector switch by The system has the selector switch by which we can select any gate. The which we can select any gate. The system has two inputs and one output. system has two inputs and one output. We use two SPDT switches for the We use two SPDT switches for the inputs and for the output we use an inputs and for the output we use an LED. LED. Gates Emulator Gates Emulator Using Using AT89C2051 AT89C2051

Upload: deepak4u

Post on 10-Apr-2015

562 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Gates Emulator Using 8051

This project Digital gated Emulator using This project Digital gated Emulator using Microcontroller is used to emulate the Microcontroller is used to emulate the basic gates such us NOT, OR, AND.basic gates such us NOT, OR, AND.

The system has the selector switch by The system has the selector switch by which we can select any gate. The system which we can select any gate. The system has two inputs and one output.has two inputs and one output.

We use two SPDT switches for the inputs We use two SPDT switches for the inputs and for the output we use an LED.and for the output we use an LED.

Gates Emulator Using Gates Emulator Using AT89C2051AT89C2051

Page 2: Gates Emulator Using 8051

The gate selection can be done by the The gate selection can be done by the selector switch and it is also indicated selector switch and it is also indicated on separate LED's. on separate LED's.

There are three LED's provided on the There are three LED's provided on the board for the gates NOT, OR, AND. board for the gates NOT, OR, AND.

The corresponding LED will glow for the The corresponding LED will glow for the corresponding gate. corresponding gate.

The main operation is done by the The main operation is done by the Microcontroller through its ports. Microcontroller through its ports.

The Microcontroller gets the input The Microcontroller gets the input through the ports and it will produce through the ports and it will produce the output according to the gate the output according to the gate selected.selected.

Page 3: Gates Emulator Using 8051

CIRCUIT DIAGRAMCIRCUIT DIAGRAM

Page 4: Gates Emulator Using 8051
Page 5: Gates Emulator Using 8051

AT89C2051 ‘SAT89C2051 ‘SPIN DIAGRAMPIN DIAGRAM

Page 6: Gates Emulator Using 8051

Programming Programming ofof

at89c2051at89c2051

Page 7: Gates Emulator Using 8051

SW_ANDSW_AND EQUEQU P1.3P1.3 ; SWITCH FOR AND GATE; SWITCH FOR AND GATESW_ORSW_OR EQUEQU P1.2P1.2 ; SWITCH FOR OR GATE; SWITCH FOR OR GATESW_NOTSW_NOT EQUEQU P1.1P1.1 ; SWITCH FOR NOT GATE; SWITCH FOR NOT GATELED1LED1 EQUEQU P1.5P1.5 ; LED FOR AND GATE; LED FOR AND GATELED2LED2 EQUEQU P1.6P1.6 ; LED FOR OR GATE; LED FOR OR GATELED3LED3 EQUEQU P1.7P1.7 ; LED FOR NOT GATE; LED FOR NOT GATESW1SW1 EQUEQU P3.5P3.5 ; FIRST INPUT SWITCH; FIRST INPUT SWITCHSW2SW2 EQUEQU P3.7P3.7 ; SECOND INPUT SWITCH; SECOND INPUT SWITCHSW3SW3 EQUEQU P1.0P1.0 ; THIRD INPUT SWITCH; THIRD INPUT SWITCHOPOP EQUEQU P1.4P1.4 ; LED FOR OUTPUT; LED FOR OUTPUTORG 0000HORG 0000HTOP:TOP: SETB LED1SETB LED1 SETB LED2SETB LED2

SETB LED3SETB LED3 SETB OPSETB OP

Page 8: Gates Emulator Using 8051

SETB SW_AND ;here 1 because we need I/PSETB SW_AND ;here 1 because we need I/P JNB SW_AND,AND1 ; if pressed then go to AND1JNB SW_AND,AND1 ; if pressed then go to AND1

SETB SW_OR SETB SW_OR JNB SW_OR,OR1JNB SW_OR,OR1 ; checking weather its pressed ; checking weather its pressed

SETB SW_NOT ; SETB SW_NOT ; JNB SW_NOT,NOT1 JNB SW_NOT,NOT1 SJMP TOPSJMP TOPAND1:AND1:UP1: SETB SW_ANDUP1: SETB SW_AND JB SW_AND,TOP ; if unpressed then go to TOPJB SW_AND,TOP ; if unpressed then go to TOP

CLR LED1CLR LED1 SETB SW1SETB SW1 SETB SW2SETB SW2 SETB SW3SETB SW3 JNB SW1,DWN1JNB SW1,DWN1

Page 9: Gates Emulator Using 8051

JNB SW2,DWN1JNB SW2,DWN1JNB SW3,DWN1JNB SW3,DWN1CLR OPCLR OPSJMP UP1SJMP UP1

DWN1:DWN1:SETB OPSETB OPSJMP UP1SJMP UP1

OR1:OR1:UP2:UP2: SETB SW_ORSETB SW_OR

JB SW_OR,TOP ; if unpressed then go to TOPJB SW_OR,TOP ; if unpressed then go to TOPCLR LED2CLR LED2SETB SW1SETB SW1SETB SW2SETB SW2SETB SW3SETB SW3JB SW1,DWN2JB SW1,DWN2JB SW2,DWN2JB SW2,DWN2

Page 10: Gates Emulator Using 8051

JB SW3,DWN2JB SW3,DWN2SETB OPSETB OPSJMP UP2SJMP UP2

DWN2:DWN2:CLR OPCLR OPSJMP UP2SJMP UP2

NOT1:NOT1:UP3:SETB SW_NOTUP3:SETB SW_NOT

JB SW_NOT,TOP ; if unpressed then go to TOPJB SW_NOT,TOP ; if unpressed then go to TOPCLR LED3CLR LED3SETB SW1SETB SW1JB SW1,DWN3JB SW1,DWN3CLR OPCLR OPSJMP UP3SJMP UP3

Page 11: Gates Emulator Using 8051

DWN3:DWN3:

SETB OPSETB OP

SJMP UP3SJMP UP3

END END