---
title: "Gas chamber STP monitoring with 8255 and ADCs"
subject: "Instrumentation II"
chapter: 4
key: "semester_5/instrumentation_ii:gas-chamber-stp"
source: https://www.bctengineer.com/q/semester_5/instrumentation_ii/gas-chamber-stp
site: BCT Engineering
---

# Gas chamber STP monitoring with 8255 and ADCs

Instrumentation II · Chapter 4: Interfacing A/D And D/A Converters

- Asked in: 2079 Baisakh, 8 marks
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/instrumentation_ii/gas-chamber-stp
- Whole chapter: https://www.bctengineer.com/md/semester_5/instrumentation_ii/chapter-4

## Question

Consider yourself as a fluid dynamic engineer, who has been assigned the task of designing a hardware circuit that keeps a gas chamber under standard temperature and pressure (STP) conditions. The circuit should be an MBI system, an 8255 PPI, two 10-bit ADCs and appropriate temperature and pressure sensors that constantly monitor the pressure and temperature inside the gas chamber. An alarm LED should be lighted to notify the operator when either the temperature exceeds zero degree Celsius or the pressure exceeds hundred Kilopascals. Calibrate your temperature and pressure sensors accordingly. Sketch your design, show the necessary control words, and draw an appropriate flowchart to show the logic of your software algorithm.

## Short answer

The MBI system uses an 8255 PPI (control word 93H) with two 10-bit ADCs sharing ports A and B. Start conversion via PC4, read EOC on PC0/1, and enable output on PC5/6. Alarm LED (PC7) lights if temperature >0°C (reading >0156H) or pressure >100 kPa (>0201H).

## Answer

#### Assumptions
STP: 0 deg C and 100 kPa (IUPAC). The alarm LED turns on when the temperature is above 0 deg C or the pressure is above 100 kPa. The system uses an 8085 with the 8255 I/O mapped at **80H (A), 81H (B), 82H (C), 83H (control)**. Two identical 10-bit ADCs with tri-state outputs share the data lines.

#### Sensor calibration
- **Temperature:** the range -20 to +40 deg C (60 deg C span) is mapped to 0-5 V by the conditioner (RTD/LM35 + offset + gain): V = 5 x (T + 20)/60. At 0 deg C: 1.667 V = (1.667/5) x 1024 = 341 = **0155H**.
- **Pressure:** the range 0-200 kPa is mapped to 0-5 V (pressure transducer + amplifier). At 100 kPa: 2.5 V = 512 = **0200H**.
- Resolution: temperature 60/1024 = 0.059 deg C per count; pressure 200/1024 = 0.195 kPa per count.
- The alarm is given when a reading is above its threshold: compare with 0156H (T) and 0201H (P).

#### Design
```text
 Temp sensor -> cond. -> ADC-T (10 bit) --+ D0-D7 --> PA0-PA7
 Press sensor-> cond. -> ADC-P (10 bit) --+ D8,D9 --> PB0,PB1
 PC4 -> START of both ADCs     PC0 <- EOC of ADC-T, PC1 <- EOC of ADC-P
 PC5 -> OE of ADC-T            PC6 -> OE of ADC-P
 PC7 -> transistor -> ALARM LED
 8085 AD0-7 -> D0-7 of 8255;  IOR', IOW', A0,A1, CS' (A7-A2 = 100000)
```
Data from the selected ADC (only one OE is active at a time) appear on port A (low 8 bits) and PB0-PB1 (high 2 bits).

#### Control word
Port A input, port B input, port C upper output (PC4-PC7), port C lower input (PC0-PC3), mode 0: 1001 0011 = **93H**.

The bit set/reset (BSR) control words written to 83H are: PC4 (START) = 09H set / 08H reset; PC5 (OE-T) = 0BH / 0AH; PC6 (OE-P) = 0DH / 0CH; PC7 (LED) = 0FH / 0EH. BSR is used so that changing one control line never disturbs the LED bit.

#### Algorithm and flowchart
```text
 START -> Init 8255 (93H), LED off
   -> Start conversion of both ADCs (PC4 pulse)
   -> Wait until EOC-T and EOC-P are both 1
   -> Enable OE-T, read 10-bit T, disable OE-T
   -> T > 0156H ? --yes--> LED ON (alarm)
         | no
   -> Enable OE-P, read 10-bit P, disable OE-P
   -> P > 0201H ? --yes--> LED ON
         | no
   -> LED OFF -> repeat
```

#### Program
```text
        MVI A,93H
        OUT 83H         ; mode word
        MVI A,0EH
        OUT 83H         ; LED (PC7) off
LOOP:   MVI A,09H
        OUT 83H         ; START = 1 (PC4)
        MVI A,08H
        OUT 83H         ; START = 0
WAIT:   IN 82H
        ANI 03H         ; EOC-T and EOC-P
        CPI 03H
        JNZ WAIT
        MVI A,0BH
        OUT 83H         ; OE-T = 1 (PC5)
        IN 80H
        MOV L,A
        IN 81H
        ANI 03H
        MOV H,A         ; HL = 10-bit temperature
        MVI A,0AH
        OUT 83H         ; OE-T = 0
        MOV A,L
        SUI 56H
        MOV A,H
        SBI 01H         ; HL - 0156H
        JNC ALARM       ; no borrow : T > 0 deg C
        MVI A,0DH
        OUT 83H         ; OE-P = 1 (PC6)
        IN 80H
        MOV L,A
        IN 81H
        ANI 03H
        MOV H,A         ; HL = pressure
        MVI A,0CH
        OUT 83H         ; OE-P = 0
        MOV A,L
        SUI 01H
        MOV A,H
        SBI 02H         ; HL - 0201H
        JNC ALARM       ; no borrow : P > 100 kPa
        MVI A,0EH
        OUT 83H         ; LED off
        JMP LOOP
ALARM:  MVI A,0FH
        OUT 83H         ; PC7 = 1 : alarm LED on
        JMP LOOP
```

## Check yourself

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

1. With -20 to +40 deg C mapped to 0-5 V on a 10-bit ADC, what code corresponds to 0 deg C?
   A. 0155H
   B. 0200H
   C. 03FFH
   D. 0100H
   Answer: A. V = 5 x 20/60 = 1.667 V, and 1.667/5 x 1024 = 341 = 0155H. (Key point: Temperature threshold)

2. With 0-200 kPa mapped to 0-5 V on a 10-bit ADC, which code corresponds to 100 kPa?
   A. 0155H
   B. 0100H
   C. 0200H
   D. 03FFH
   Answer: C. 100 kPa is half scale: 2.5 V = 512 = 0200H. (Key point: Pressure threshold)

3. Ports A and B input, upper C output, lower C input, mode 0 gives which control word?
   A. 90H
   B. 93H
   C. 99H
   D. 83H
   Answer: B. 1001 0011: A in, C upper out, B in, C lower in = 93H. (Key point: Control word)

4. Why are the OE signals of the two ADCs enabled one at a time?
   A. To save power only
   B. To start conversion
   C. To set the alarm
   D. The ADC outputs share the same data lines, so only one tri-state output may drive them
   Answer: D. Two active outputs would conflict on the shared lines; one OE is enabled while reading. (Key point: Sharing data lines)

## Related in Instrumentation II

- [Ice cream factory MBI with 8255 at 5000H](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aicecream-ppi-5000h) — Instrumentation II, chapter 2
- [8255 interface with switches and 7-segment](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-switch-sevenseg) — Instrumentation II, chapter 2
- [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
- [8-channel ADC interface with 8255 and 8085](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc8-8255-problem) — Instrumentation II, chapter 4
- [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
- [ADC with 8085 using 8255: fan and heater control](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc-8255-fan-heater) — Instrumentation II, chapter 4

## Related in other subjects

- [Gas under piston: pressure, volume doubled](https://www.bctengineer.com/question.md?key=semester_2%2Ffundamental_of_thermodynamics_and_heat_transfer%3Agas-cylinder-piston-pressure-490n) — Fundamental of Thermodynamics & Heat Transfer, chapter 1
- [Gas turbine combustion chamber: requirements and types](https://www.bctengineer.com/question.md?key=semester_7%2Fturbo_machines%3Acombustion-chamber-requirements-types) — Turbo Machines, chapter 3
- [Ideal gas turbine 100 kW: pressure ratio, work, efficiency](https://www.bctengineer.com/question.md?key=semester_2%2Ffundamental_of_thermodynamics_and_heat_transfer%3Aideal-gas-turbine-100kw-pressure-ratio) — Fundamental of Thermodynamics & Heat Transfer, chapter 6
- [Two-shaft gas turbine, pressure ratio 7:1](https://www.bctengineer.com/question.md?key=semester_7%2Fpower_plant_equipment%3Agt-two-shaft-7-1) — Power Plant Equipment, chapter 6, asked 2×
