285/317
9 - A Carrier-current System for domestIc Remote Control
SwitchMotor ( STOP_OPEN ) ;
break ;
case START_CLOSE :
if ( ReadADC ( MOTOR_ADC_CHANNEL ) < RUNNING_VOLTAGE )
SwitchMotor ( STOP_CLOSE ) ;
break ;
}
}
}
9.4 CONCLUSION
This first application has been designed to emphasize the following features:
Using C language in a small system
The various uses of the timers
Use of the analog to digital converter
The features relating to power consumption, both hardware and software
The C code used here shows that C is not a language that requires extensive hardware and a
huge investment in know-how. On the contrary, with a little practice, very few parts of your pro-
grams will turn out to be written in assembler, because you will find it much easier to write in
C. When adequately commented and structured, a C program is naturally easier to read and
modify later in the life of the product than an assembly program. Also, we can see that any
parts of the program that still require assembler can be written very easily, within the C source
code, without needing to write and assemble another file for assembler language.
The timers have been used in PWM mode with capturing and in free-running mode with com-
parison. These are only some of the ways of using the timers, but these are worth knowing.
Actually, the application could have been done in a less sophisticated way, especially relating
to the phase lock loop scheme; but this application gives a good example of the possibilities
available even in a low-end product like the 72251. This scheme adds robustness to the
working of the transmitter and the receiver, at no cost except for a few additonal program lines.
This can make the difference between a good product and a poor one, and does not add to the
hardware cost.
The analog to digital converter has been fully used, since it does not have many modes; its
shut-down feature contributed to the solution to the power consumption problem.
The power drainage of the ST7, already low, could be further reduced by slowing the clock
down as much as possible taking into account the required computing power needed. W ith the
help of the wait instruction that stops the core, and the shut-down feature of the analog to dig-
ital converter, the requirement of a total consumption less than 3 mA was met, even with re-
lays that consume 40 mA each for short periods.
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...