---
title: "Ice cream factory MBI with 8255 at 5000H"
subject: "Instrumentation II"
chapter: 2
key: "semester_5/instrumentation_ii:icecream-ppi-5000h"
source: https://www.bctengineer.com/q/semester_5/instrumentation_ii/icecream-ppi-5000h
site: BCT Engineering
---

# Ice cream factory MBI with 8255 at 5000H

Instrumentation II · Chapter 2: Parallel Interfacing With Microprocessor Based System

- Asked in: 2073 Shrawan, 1+1+2+2+4 marks
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/instrumentation_ii/icecream-ppi-5000h
- Whole chapter: https://www.bctengineer.com/md/semester_5/instrumentation_ii/chapter-2

## Question

Assume that your group has decided to make microprocessor based instrumentation system for an Ice Cream Factory using an 8255 PPI card at base address 5000H in memory mapped I/O mode for controlling purpose. You need to measure pressure and temperature of a manufacturing plant. (i) List out the collected documents and components. (ii) List out different signals you need to derive and or can be directly connected to your interfacing circuit. (iii) Draw minimum mapping circuit for above system. (iv) What are the addresses captured by your card? Generate the control word for the system. (v) Write a program module for measuring temperature and control if the temperature is not in the range. Assume suitable data if necessary.

## Short answer

8255 memory-mapped at 5000H-5003H, control word 91H (port A input, B output, C upper output/lower input). Temperature from LM35 via ADC0808 on CH0; program reads ADC, compares with 33H (20°C) and 66H (40°C), turns on heater (PB0) if low, cooler+alarm (PB1+PB2) if high.

## Answer

#### Assumptions
8085 system, 8255 memory mapped at 5000H-5003H, A0/A1 of the 8085 to A0/A1 of the 8255. Temperature sensor LM35 (10 mV/deg C) and a pressure transducer (0-5 V) feed an ADC0808 (8-bit, 8-channel, CH0 = temperature, CH1 = pressure). Temperature must stay between 20 deg C and 40 deg C (0-100 deg C scaled to 0-5 V, so 1 count = 0.39 deg C). A heater/cooler relay is driven by PB0 (heater) and PB1 (cooler), and PB2 = alarm.

#### (i) Documents and components
- Documents: datasheets of 8085, 8255, ADC0808, LM35/pressure sensor, 74LS373, 74LS138/gates; process requirement and specification; circuit and wiring diagrams; address map; flowchart and program listing; test and calibration procedure.
- Components: 8085 CPU, 8255 PPI, ADC0808, 74LS373 latch, 2K/4K ROM, RAM, decoder gates, sensors, op-amp signal conditioner, relay drivers (transistors with diodes), relays, buzzer, clock crystal, reset circuit, power supply.

#### (ii) Signals
- Directly connected: AD0-AD7 (as D0-D7), RD', WR', RESET OUT -> RESET of 8255, A0, A1 (latched A0, A1) -> A0, A1 of 8255.
- Derived: latched low address A0-A7 (ALE and 74LS373), CS' of the 8255 from A15-A2 and IO/M, ADC clock (from CLK OUT divided), ALE/START and OE of the ADC from port C.

#### (iii) Minimum mapping circuit
5000H = 0101 0000 0000 0000, so A15 = 0, A14 = 1, A13 = 0, A12 = 1 and A11-A2 = 0. Lines that must be 1 (A14, A12) are connected directly, and lines that must be 0 (A15, A13) go through inverters.
```text
 A15 --[NOT]--+
 A14 ---------+
 A13 --[NOT]--+
 A12 ---------+--[ AND ]--[NOT]--> CS' (low when 5000H-5003H is accessed)
 A11..A2 -[NOR]+     (output 1 only if A11..A2 are all 0)
 IO/M --[NOT]-+      (IO/M = 0 for a memory cycle)
 8255: D0-D7, RD', WR', A0, A1, RESET

 PA0-7 <- ADC data     PC0 <- EOC      PC4 -> START/ALE
 PC5 -> OE   PC6 -> ADD A (channel)    PB0-PB2 -> relay/alarm drivers
```

#### (iv) Addresses and control word
A15-A2 = 0101 0000 0000 00 -> Port A = **5000H**, Port B = **5001H**, Port C = **5002H**, Control = **5003H**.
Port A input (ADC data), port B output, port C upper output, port C lower input, all mode 0:
D7=1, D6D5=00, D4=1, D3=0, D2=0, D1=0, D0=1 = 1001 0001 = **91H**.

#### (v) Program (temperature; limits 20 deg C = 33H, 40 deg C = 66H)
```text
        MVI A,91H
        STA 5003H       ; initialise 8255
READ:   MVI A,00H
        STA 5002H       ; select CH0, START low
        MVI A,10H
        STA 5002H       ; START/ALE = 1
        MVI A,00H
        STA 5002H       ; START = 0, conversion begins
WAIT:   LDA 5002H
        ANI 01H         ; check EOC (PC0)
        JZ WAIT         ; wait until conversion done
        MVI A,20H
        STA 5002H       ; OE = 1
        LDA 5000H       ; read temperature code
        MOV B,A
        MVI A,00H
        STA 5002H       ; OE = 0
        MOV A,B
        CPI 33H
        JC LOW          ; below 20 C
        CPI 67H
        JNC HIGH        ; 67H or more = above 40 C (66H = 40 C)
        MVI A,00H       ; in range: all off
        STA 5001H
        JMP READ
LOW:    MVI A,01H       ; heater on
        STA 5001H
        JMP READ
HIGH:   MVI A,06H       ; cooler on + alarm
        STA 5001H
        JMP READ
```
The program is repeated for pressure by selecting CH1 (PC6 = 1) and comparing with its limits.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. With the 8255 at base 5000H (memory mapped), what is the control register address?
   A. 5003H
   B. 5001H
   C. 5002H
   D. 5000H
   Answer: A. A1 A0 = 11 selects the control register, so 5000H + 3 = 5003H. (Key point: Address map)

2. Port A input, port B output, upper C output, lower C input, all mode 0. What is the control word?
   A. 92H
   B. 89H
   C. 81H
   D. 91H
   Answer: D. D7=1, D4=1 (A in), D3=0 (C upper out), D1=0 (B out), D0=1 (C lower in) gives 1001 0001 = 91H. (Key point: Control word)

3. Why are the temperature limits 20 deg C and 40 deg C compared as 33H and 66H?
   A. Because the LM35 gives 1 V per deg C
   B. Because 8255 port A is 4 bits wide
   C. Because the ADC has 16-bit output
   D. 0-100 deg C maps to 0-5 V and the 8-bit ADC counts, so 1 count is about 0.39 deg C (20 deg C is about 51 = 33H)
   Answer: D. Scaling 100 deg C to 255 counts gives about 0.39 deg C per count; 20/0.39 is about 51 = 33H. (Key point: Range limits)

4. What does the program do when the temperature code is below the low limit?
   A. Writes 06H to port B to switch cooler and alarm on
   B. Switches all outputs off
   C. Writes 01H to port B to switch the heater on
   D. Halts the program
   Answer: C. Below 20 deg C the LOW routine turns on the heater (PB0); above 40 deg C the cooler and alarm come on. (Key point: Control action)

## Related in Instrumentation II

- [PC based concrete purifying factory with 8255](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aconcrete-purifying-ppi-4000h) — Instrumentation II, chapter 2
- [Double handshake data transfer with 8255-PPI](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Adouble-handshake-8255) — Instrumentation II, chapter 2
- [Features of microprocessor based instrumentation](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Ambi-features) — Instrumentation II, chapter 1, asked 4×
- [Types of microprocessor based instrumentation systems](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Ambi-types) — Instrumentation II, chapter 1
- [Technical benefits of 8255 PPI](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-benefits) — Instrumentation II, chapter 2, asked 2×
- [Memory-mapped I/O design for 8085](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Amemmapped-io-design-1000h) — Instrumentation II, chapter 2

## Related in other subjects

- [Memory-mapped I/O reduces address space](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Ammio-address-space) — Computer Organization and Architecture, chapter 7
- [Microprocessor based system and bus organization](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Amp-based-system-bus-organization) — Microprocessor, chapter 1, asked 5×
- [Unique/non-unique decoding, memory mapped I/O](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aunique-nonunique-decoding-memory-mapped-io) — Microprocessor, chapter 4
