- 2068 Chaitra · 8 marks
ADC with 8085 using 8255: fan and heater control
Short answer
8255 at 80H–83H, control word 91H: port A input (ADC data), port B output (PB0 heater, PB1 fan via optocouplers), PC4 START/ALE, PC5 OE, PC6 ADD A=1, PC0 EOC. ADC channel IN1 (001). Heater on for code <1AH (10°C), fan on for code >5AH (35°C).
You have to interface ADC with 8085 using 8255A ports. Interface a fan and a heater using opto couplers to derive the I/O devices. If the temperature is less than 10°C, turn on the heater and if the temperature is higher than 35°C, turn on the fan. Use port A of 8255 for transferring digital data output of ADC to the CPU and part C for control signals. Assume that an analog input is present at second input of the multiplexer and a clock input of suitable frequency is available for ADC. Also write an appropriate flow chart and algorithm to facilitate your design. Draw the diagram of your design.
Assumptions
8085 I/O mapped; 8255 at 80H (A), 81H (B), 82H (C), 83H (control). ADC0808 (8 channels, 8 bit), analog temperature signal at channel IN1 (ADD C B A = 001). Sensor LM35 (10 mV/deg C) with amplifier gain 5 so that 0-100 deg C = 0-5 V; 1 count = 0.39 deg C. Heater and fan are driven through opto-couplers (MOC3021 + triac or transistor + relay) from port B.
Threshold codes
10 deg C -> 10/100 x 255 = 25.5, take 1AH (26). 35 deg C -> 35/100 x 255 = 89.25, take 5AH (90).
Control word and port use
- Port A: input (ADC data). Port B: output (PB0 = heater, PB1 = fan, via opto-couplers). Port C upper output: PC4 = START/ALE, PC5 = OE, PC6 = ADD A (high). Port C lower input: PC0 = EOC.
- Control word: 1 00 1 0 0 0 1 = 1001 0001 = 91H.
Diagram
LM35 -> amp -> IN1 --+
| ADC0808 -- D0-D7 --> PA0-PA7
CLK (640 kHz) -------+ START,ALE <-- PC4
OE <------- PC5
ADD A <---- PC6 (=1), ADD B, C = GND
EOC ------> PC0
8085 <-> 8255 (AD0-7, IOR', IOW', A0, A1, CS')
PB0 -> [Opto-coupler] -> Heater driver -> Heater
PB1 -> [Opto-coupler] -> Fan driver -> Fan
Algorithm
- Initialise the 8255 (91H); turn heater and fan off.
- Select channel 1, give START/ALE pulse.
- Wait for EOC = 1.
- Enable OE, read port A (temperature code), disable OE.
- If code < 1AH: heater ON, fan OFF.
- Else if code > 5AH: fan ON, heater OFF.
- Else both OFF.
- Repeat from step 2.
START -> Init -> Start conversion -> EOC? -no-> wait
-> Read data -> T < 10 ? -yes-> Heater ON
-no-> T > 35 ? -yes-> Fan ON
-no-> both OFF
-> back to Start conversion
Program
MVI A,91H
OUT 83H
MVI A,00H
OUT 81H ; heater, fan off
LOOP: MVI A,40H ; ADD A=1, START=0
OUT 82H
MVI A,50H ; START/ALE = 1
OUT 82H
MVI A,40H ; START = 0 : conversion begins
OUT 82H
WAIT: IN 82H
ANI 01H ; EOC (PC0)
JZ WAIT
MVI A,60H ; OE = 1
OUT 82H
IN 80H ; read temperature
MOV B,A
MVI A,40H ; OE = 0
OUT 82H
MOV A,B
CPI 1AH
JC HEAT ; below 10 C
CPI 5BH
JNC FAN ; above 35 C
MVI A,00H ; between: both off
OUT 81H
JMP LOOP
HEAT: MVI A,01H
OUT 81H
JMP LOOP
FAN: MVI A,02H
OUT 81H
JMP LOOP
✓ Answer checked by Claude Sonnet 5.5
Related questions
- 8-channel ADC interface with 8255 and 8085 · Instrumentation II, chapter 4
- ADC at 80H with 8255A: display on port B LEDs · Instrumentation II, chapter 2
- 8255 at A0A0H: interface and control words · Instrumentation II, chapter 2
- 8255A at B0H: add port A and B, show on port C · Instrumentation II, chapter 2
- Keyboard and printer with 8255A at 4044H · Instrumentation II, chapter 2
- Interfacing ADC0808 with 8085 using 8255A · Instrumentation II, chapter 4
- 3-phase IM principle; speed less than sync · Electrical Machine, chapter 5
- Detection gain of DSB-AM is less than 1 · Communication Systems, chapter 9
- When terminal voltage is less or more than emf · Electric Machines II, chapter 1
- 8085 ALP: transfer data with more than 3 ones · Microprocessor, chapter 2