Skip to main content

Gas chamber STP monitoring with 8255 and ADCs

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).

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.

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

 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

 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

        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

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 4 questions →