Skip to main content

Ice cream factory MBI with 8255 at 5000H

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.

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.

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.

 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)

        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.

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 2 questions →