III. (88)SOFTWARE DESIGN AND DATA
ACQUISITION SYSTEM OPERATION
(89)The control program, written in ST62 family assembly language,oversees the operation of the entire system under interrupt control..(90) This measurement system utilizes two of the microcontroller interrupts..(91) The timer interrupt is used for data collection and storage while the PC interrupt is used to trigger the process of data transfer between the computer and the system..(91) The timer interrupt is used (92)solar radiation at 10 min intervals.(93)The software and complete operation of the system can be understood from Fig.(94) 3. which shows the state machine diagram for the measurement system..(95) The system has four modes of operation:
1) acquisition or measurement;
2) storage;
3) wait mode;
4) listen mode
(96)The microcontroller was programmed to be in a low- power mode, except at specific times when data acquisition or communication with the computer is in progress..(97) The operation of this data acquisition system is similar to the one described by Lou et al. [2].
(98)When power is first applied or a reset is signaled, the first state entered is the Initialize state..(99) This state ensures that all internal variables have a defined initial value and that the input/output lines are properly configured..(100) The system then goes into the Wait state. In this mode the oscillator remains active to keep track of time but the system does nothing except to wait for the interrupts..(101) Instruction execution is stopped, internal power consumption is decreased, however, and internal RAM contents are preserved..(102) The program then starts the timer and reads channel PB0 to check if a computer is connected to the data acquisition system..(103) If the computer is not connected the timer awakens the system from the Wait mode.(104) A set oftaken and averaged.(105) If the data from sensor is less than ten (equivalent to an irradiance of 65 W/m2), the system assumes it is night time and does not record this data(106)This was done to save memory.. Only lapsed time is recorded, and the data acquisition system returns to the Wait mode..(107) The system repeatedly sleeps, awakens and keeps track of time until the data are valid.If the sampled value is above ten, the system goes into the Store state where the data are written in the external EEPROM chip.Upon completion of data storage the system switches off the LED to indicate that the acquisition and storage processes are complete..(108) It then returns to the main program where it will go back into the Wait mode again to wait for the next PC inquiry or data acquisition.Following every 10 min time, the reference and sensor signals are sampled and written to memory with each parameter using one byte.With this sampling frequency, 18 bytes of memory are used per hour during the day and only one byte for lapse time during the night.So the system can run for about a month before the 8 Kbytes of memory are filled up.
đang được dịch, vui lòng đợi..
