Custom Design of microprocessor Firmware
The project pictured here contains over 20,000 lines of source code. The project implements aspects of air conditioning control, energy management, and energy monitoring functions.
AirBorn electronics undertook the circuit design for the product, however like many electronic designs,the firmware project (also completed by AirBorn Electronics) was much larger than the hardware.
The product is networked with other units to provide extensible input/output capability. The networked units can be configured and monitored through a host link designed for connection to one or more PC's, with an intermediate modem if required. The units can also be programmed to dial out to the host computer periodically, (or when data collection buffers have reached a programmable threshold) using the modem.
The product has the capability of remote download of program updates. This is accomplished using FLASH devices for the program code memory. The original shipped firmware remains write protected, but the remainder of the FLASH memory can be re-written by the host computer. Upon reset the original shipped firmware is run, this firmware determines if a newer version of code is present in the upper region of the FLASH device by using a CRC check. If the newer version of code is detected execution transfers to this code. This method prevents unrecoverable system crashes that can otherwise occur when if a new program download is corrupted.
The project has two versions, one of which contains energy monitoring capability and is normally configured with a modem, and the other being specifically targeted at online applications with no modem. The code between the two versions varies quite markedly, but there are large common areas of program also. To ease maintenance requirements, one set of source code is used for both products, with an assembly time switch selecting which set of final product code is produced.
The product has a large number of analog inputs, together with conditioning circuitry so that a number of different types of devices can be connected - for instance temperature sensors, current transformers, 4-20ma devices. Several relay outputs and analog outputs are also provided. Drivers for all these devices are provided in the firmware.
The data monitoring task required time stamping of samples collected. There are two modes of data collection, one of which is continuous (on programmable, but nominally 15 minute intervals) and the other is a "snapshot", triggered at a certain time or on a certain event, and running at higher resolution until completion. Special system events, such as power failure, system watchdog, system download or daylight savings were also logged along with the standard data monitoring.
Several special purpose firmware functions were included in the product. These included such functions as two dimensional bi-linear interpolation of lookup table values, and some advanced rules-based plant switching to equalize hours run.
It's hard to make a program foolproof because fools are so ingenious. -- from 'Fortunes'