The design presented here provides a simple method for controlling process variables such as temperature, pressure, flow, etc., via user-selectable control functions (e.g., proportional, integral, and differential). The PAL chip 16L8 is programmed to work as a 4-bit subtractor. Two such PAL 16L8s, shown in the figure, accept two 8-bit data bytes representing the setpoint value (B) and the measured process variable value (A). They provide an 8-bit error signal through the subtraction process. By selecting the PAL ICs through chip select —CS1, the PC reads this “Error Value.” The error output is merely the deviation between the set and measuring parameters.
If the measured parameter is high in comparison with the set parameter, the PAL error output will be negative; otherwise it will be positive. The MSB of the error output indicates the sign bit. The logic high and logic low in the sign bit indicate that the error is negative and positive, respectively.
The “Special BIOS” interrupt, (INT 1Ch), available in all PCs, is used in this design to read the error value through the PAL port, as well as write the appropriate control responses to the DAC port by selecting the DAC through —CS2. The INT 1Ch interrupt is a hardware interrupt (see “Special BIOS Interrupt for Real-time Data Acquisition and Control,” ELECTRONIC DESIGN, May 1, 1997, p. 173). It automatically occurs 18.2 times per second and is invoked by the BIOS timer interrupt after it updates the time-of-day count.
At startup, the vector for the interrupt points to an IRET (interrupt return) instruction—when the interrupt is called, it simply returns. Changing this interrupt vector to point to a procedure in your program will cause the procedure to be called 18.2 times per second.
Variables in typical process control environments are very slow compared to the INT 1Ch interrupt rate. For every INT 1Ch, the ISR program in this application must read the PAL port and write the appropriate control function digital response in the DAC port. The data output to the control port may be for proportional, integral, differential, or on/off control functions, depending upon the procedure in the user program for INT 1Ch. Remember that once the vector is changed, the procedure will immediately begin to be invoked every 18th of a second.
Care should be taken to save changed registers and to minimize code execution time in this interrupt handler. Depending upon the error value, the DAC output and hence the op-amp output that drives the load through the buffer will be updated at each INT 1Ch interrupt.