microprocessor , microcontroller
microprocessor , microcontroller
1
Port programming
Implementation of Digital Circuits
Parallel Ports
• Initialize the Input Ports
8 bit port
eg. MOV P1, #0FFH
1 bit port
eg. SETB P1.5
NOTE:
OUTPUT PORTS ARE NOT INITALIZED
• Transfering 8 bit data
6
Digital circuit
• Assume
• INPUT
A=P1.0
B=P1.1
C=P1.2
• OUTPUT
Q=P2.0
7
Digital circuit
• Org 0000h
• SETB P1.0
• SETB P1.1
• SETB P1.2
• MOV C,P1.0
• ANL C, P1.1
• MOV ACC.7,C
• MOV C, P1.1
• ORL C, P1.2
• MOV ACC.6,C
• MOV C,P1.2
• ANL C,P1.1
• ANL C,ACC.6
• ORL C,ACC.7
• MOV P2.0,C
• END
8
Digital circuit Program
• Org 0000h
• SETB P1.0;INITIALIZE
• SETB P1.1;INITIALIZE
• SETB P1.2;INITALIZE
• MOV C,P1.0
• ANL C,P1.1
• MOV ACC.7,C
• MOV C,P1.1
• ORL C,P1.2
• MOV ACC.6,C
• MOV C, P1.2
• ANL C,P1.1
• ANL C, ACC.6
• ORL C,ACC.7
• MOV P2.0,C
• END
9
TASK 1: Implementation of digital circuits using KEIL
for an 8051 Microcontroller
ORG 0000H
SETB ACC.0; Input A
SETB ACC.1; Input B
MOV C, ACC.1
CPL C
ANL C, ACC.0
MOV ACC.2, C; Output C
MOV C, ACC.0
ANL C, ACC.1
MOV ACC.3, C; Output D
H: SJMP H
END
13
RESULT:
S.NO A B Output (C) Output(D)
1 0 0
2 0 1
3 1 0
4 1 1
14