Unit 7
Unit 7
PB0 – PB7: The 8 bit port B can be programmed as all input or as all output. Port B
cannot be used as a bidirectional port.
PC0 – PC7: This 8 bit port C can be all input or all output. It can also be split into
two parts, CU (port c upper PC4 – PC7) and CL (port c lower PC0- PC3). Each can be
used for input or output.
RD and WR: These tow active - low control signals are inputs to the 8255. The RD
and WR signals from the 8051 are connected to these inputs, to read data from
8051 or to write data to the 8051 microcontroller.
D0 – D7: The data pins of the 8255 are connected to the data pins of the
microcontroller allowing it to send data back and forth between the controller and the
8255 chip.
RESET: This is an active – high signal input into the 8255 used to clear the control
register. When RESET is activated, all ports are initialized as input ports. In many
designs this pin is connected to the RESET output of the system bus or grounded to
make it inactive.
A0, A1 and CS: While CS (chip select) selects the entire chip, it is A0 and A1 that select
specific ports. These three pings are used to access ports A, B,C or the control register.
BLOCK DIAGRAM OF 8255 PPI:
PA7- PA0
GROUP
GROUP A
A
CONTROL PORT A
WRITE
A0
CONTROL
A1 LOGIC GROUP PB7-PB0
B
GROUP B
RESET CONTROL
PORT B
CS
CONTROLWORD REGISTER OF 8255:
D7 D6 D5 D4 D3 D2 D1 D0
PORT C
1 = I/O MODE
MODE SELECTION (LOWER
PORT A
0 = BSR MODE 0 = MODE 0 PC3 – PC0)
1= INPUT
1 = MODE 1 1 = INPUT
0 = OUTPUT
0 = OUTPUT
While ports A, B, and C are used to input or output data, it is the control
register that must be programmed to select the operation mode of the three ports.
The ports of the 8255 can be programmed in any of the following modes.
MODE 0 (SIMPLE I/0 MODE): In this mode, any of the ports A, B, CL and CU can be
programmed as input or output in this mode, all bits are out or all are in. in other
words, there is no such things as single bit control as we have seen in P0-P3 of the
8051. Since the vast majority of applications involving the 8255 use this simple I/O
mode.
MODE 1: in this mode, ports A and B can be used as input or output port with
handshaking capabilities. Handshaking signals are provided by the bits of port C.
MODE 2: In this mode, port A can be used as a bidirectional I/O port with
handshaking capabilities whose signals are provided by port C. Port B can be used as
simple I/O mode or MODE 1.
BSR (BIT SET / RESET) MODE: In this mode, only the individual bits of port C can be
programmed.
P3.7
P3.6
P2.7
WR RD
ALE CS PA
8051 P2.0
8255 PB
P0.7
P0.6
A1 PC
P0.5
P0.4
P0.3
74LS373 A0
P0.2
P0.1 D7 D6 D5 D4 D3 D2 D1 D0 RES
P0.0
ADC0804 CHIP:
CS (CHIP SELECT):
Chip select is an active low input used to activate the ADC0804
chip. To access the ADC0804, this pin must be low.
RD (READ):
This is an input signal and is active low. The ADC converts the
analog input to its binary equivalent and holds it in an internal register to get the
converted data out of the ADC0804 using RD, if high to low pulse is applied to the RD
pin; the 8 bit digital output shows up at the D0 – D7 data pins. The RD pin is also
referred to as output enable (OE).
PIN DIAGRAM OF ADC0804
+5v
10K
V in (+) D0
V in (-) D1
A GND A D2
V ref/2 D D3 LED’S
10K CLK R C D4
150PF CLK in 0 D5
8 D6
CS 0 D7
RD 4 WR
D GND INTR
f = 1/1.1RC
Typical values are R = 10Kohms and C = 150pf. Substituting in the above equation, we
get f= 606KHZ. In that case, the conversion time is 110 micro seconds.
V ref/2:
If V ref/2 is not connected, the analog input voltage for the
ADC0804 is in the range of 0 to 5v. However, there are many applications where the
analog input applied to V in needs to be other than the 0 to 5v range. V ref/2 is used
to implement analog input voltage other than 0 to 5v.
D0 - D7:
The data bus used to carry data back and forth between ADC0804 to
8051 micro controller.
VOUT = V ref /r14 [A0/2 + A1/4 + A2/8 + A3/16 + A4/32 + A5/64 + A6/128 + A7/256]
Where A0 is the LSB and A7 is the MSB for the inputs and V ref is
the input voltage that must be applied to pin 14. Some DAC’s also use the Zener diode
(LM336), which overcomes any fluctuation associated with the power supply voltage.
CHARACTERSTICS OF DAC:
Digital to analog converter mainly depending upon the two characteristics
(1)Resolution (2) full scale output voltage
Resolution: The first characteristic of the DAC to consider as a resolution this is
determined by the no of bits in the binary input, a converter with 8 binary inputs means
it has 28 or 256 possible levels.
Full scale output voltage: Let us assume if DAC is a 10 volts output converter, it will not
get the 10 volts output voltage. Because due to the full scale output voltage. And the
method of full-scale output voltage is explained below
V out = V ref/R14 XR0 [A0/2 +A1/4 +A2/8 +A3/16 + A4/32 + A5/64 +A6/128 + A7/256]
If all the bits are high A0 – A7 = 11111111, V ref = 2v, R14 = 1K, R0 = 5K
V out = 2/1x103 x 5 x 103 [ 1/2 + 1/4 + 1/8 + 1/16+ 1/32+ 1/64+ 1/128+ 1/256]
V out = 10[255/256] = = 9.961 = 10v
PIN DIGRAM OF MC1408 OR DAC0808:
(+5V)
13 R14
A0 5 14 V ref
A1 6 15
D
A2 7 A 1
C
A3 8 0 2
8
A4 9 0
R0 8
A5 10 V0 4
A6 11
A7 12
16 3
INTERFACING OF 8051 TO MC1408 OR DAC0808:
13
P1.0 5 14
P1.1 6 15
8 D
P1.2 7 A 1
0 C
P1.3 8 0 2
5 8
P1.4 9 0
1 8
P1.5 10 4
P1.6 11
P1.7 12
16 3