To develop Temperature Control system using 8086
Microprocessor trainer kit, Temperature controller kit, power supply, data cable etc
Temperature control system involved interfacing successive approximation ADC and typical method of measuring and controlling the temperature using microprocessor. ADC is among the most widely used devices for data acquisition. A digital computer uses binary values, but in physical world everything is analog, temperature, pressure, humidity, and velocity are few examples of physical quantities that we seal with every day.
Temperature measurement is of great importance in industry as most of the processes are temperature dependent. A number of devices and schemes have been used over the years, for the measurement of temperature. Typical sensors include devices like thermocouples, thermostats, RTD’s and semiconductor sensor.
This system uses semiconductor sensor AD590 to monitor the temperature of water bath. The AD590 is basically a PTAT (proportional to absolute temperature) current regulator. It generates a current O/P of 1µA/K above absolute zero temperature that is -2730C. Thus at 00C the current O/P will be 273µA and 250 if will be 298µA and 373mV at 1000. This O/p is buffered through an OPAMP having a gain of 10. To enable easy equivalence between the transducers O/P in volts and the measured temperature a calibration procedure needs to be done.
WORKING:-
8255 is interfaced with 8086 in I/O mapped I/O. port A (PA0-PA7) as input port is connect to data lines of ADC, PB0, PB1, PB2 lines of port B for channel selection, PC2 connected to Start of conversion (SOC) and PC3 to O/P enable. Channel 1 of ADC is used to input analog signal, Channel 0 of ADC for temperature controller.
ADC will give binary equivalent of the I/P voltage. Input will vary from 0 to 5V (0 to 100 degree C) and the ADC O/P varies from 00-FFH. So 5V/100 i.e. 5000mvs/100 gives 50mvs/0C. And the counts for indication of temperature are taken as 2.5 (256/100) per degree C.
AC supply to the external heating element is controlled through the onboard Relay, based on the set value. When the temperature of the heating element (which is sensed by AD590, AD590 output is analog which is converted to digital by ADC) is less than the set value (reference value) heating element will be switched ON and when temperature crosses the set temperature AC supply is turned OFF.
MODEL SMALL
.STACK 100
.DATA
START:
PORTA EQU FFC0H ; PORTA address
PORTB EQU FFC2H ; PORTB address
PORTC EQU FFC4H ; PORTC address
CTL EQU FFC6H ; Control port address
CTL_BYTE EQU 98H ; 8255 control reg.
CLEAR_DISPLAY EQU F800:4BB1H
DWAD EQU F800:4BB1H
DBDTA EQU F800:4F1F
DEC_TEMP DB 0
SET_TEMP DB 0
ADC_VAL DB 0
COUNT DB 0
PRE_TEMP DB 0
.CODE
ADC TABLE:
DB 00H,03H,05H,08H,0aH,0dH,0fH,11H,14H,16H
DB 19H,1cH,1eH,21H,24H,27H,2aH,2cH,2eH,32H
DB 34H,36H,39H,3cH,3fH,42H,45H,48H,4aH,4cH
DB 4eH,50H,52H,54H,56H,58H,5bH,61H,64H,67H
DB 6aH,6dH,70H,72H,74H,77H,7aH,7dH,7fH,82H
DB a0H,a2H,a5H,a8H,aaH,aDH,afH,b0H,b3H,b6H
DB b9H,bcH,bfH,c1H,c4H,c6H,c9H,ccH,cfH,d0H
DB d2H,d5H,d7H,daH,dcH,dfH,e0H,e2H,e5H,e7H
DB e9H,ebH,eeH,f1H,f4H,f6H,f9H,fcH,ffH
START:
MOV AL,CTL_BYTE ; 8255
MOV DX,CTL ; PORTC (lower) as output
OUT DX,AL ; PORTA as input
MOV AL,DEC_TEMP
CALL DEC_HEX
MOV SET_TEMP,AL
MOV AL,DEC_TEMP
MOV AH,00
MOV SI,AX
CALL FAR DWAD
MOV DX,CTL
MOV AL,02
OUT DX,AL
MOV AL,00
OUT DX,AL
MOV CX,70
L0:
LOOP L0
BACK:
MOV COUNT,0
CALL ADC
CALL DISP_TEMP
CALL TEMP_CONTL
JMP BACK
DISP_TEMP:
MOV AL,ADC_VAL
MOV SI,OFFSET ADC_TABLE
AGAIN:
CMP AL,[SI]
JC FOUND
JE FOUND
INC SI
INC COUNT
JMP AGAIN
FOUND:
MOV AL,COUNT
CALL HEX_DEC
MOV AH,0
MOV SI,AX
CALL FAR DBDTA
RET
TEMP_CONTL:
MOV AL,COUNT
CMP AL,SET_TEMP
JC TURN_ON_RELAY
RELAY_OFF:
MOV DX,PORTB
MOV AL,0FFH
OUT DX,AL
MOV DL,20H
HERE1:
MOV CX,FFFFH
HERE:
LOOP HERE
DEC DL
JNZ HERE1
RET
TURN_ON_RELAY:
MOV DX,PORTB
MOV AL,00H
OUT DX,AL
CONTINUE:
MOV CX,FFFFH
L22:
LOOP L22
RET
ADC:
MOV DX,CTL
MOV AL,01
OUT DX,AL
MOV CX,70
L10:
LOOP L10
MOV AL,00
OUT DX,AL
L1:
MOV DX,PORTC
IN AL,DX
AND AL,80H
CMP AL,80H
JNZ L1
MOV DX,PORTA
IN AL,DX
MOV ADC_VAL,AL
RET
HEX_DEC:
MOV AH,00H
MOV CL,0AH
DIV CL
MOV CL,04H
ROL AL,CL
AND AL,F0H
OR AL,AH
RET
DEC_HEX:
MOV BL,AL
AND BL,0FH
AND AL,F0H
MOV CL,04
ROR AL,CL
MOV CL,0AH
MUL CL
ADD AL,BL
RET
END START
PROCEDURE:-
1. Connect power supply 5V & GND to both microprocessor trainer kit & temperature controller interfacing kit.
2. Connect data bus between microprocessor trainer kit & temperature controller interfacing kit.
3. Enter the program to read temperature of the water bath from ADC at 0000:4000.
4. Execute the program by typing GO 0000:4000 enter.
5. Enter the reference temperature value, when temperature of water bath exceeds reference value then power supply to water bath is switched OFF.
You might be also interested in:
:: Assembly Language Program to serve NMI
:: Interfacing Stepper Motor to 8086 using 8255