282/317
9 - A Carrier-current System for domestIc Remote Control
The control of the relay coils
The relays are arranged so that one relay switches the motor on or off, while the other relay
selects the open or close direction.
As said above, the relays are of the locking- or bistable-type. This means that only a short
pulse of current in the coil is needed to trip the relay from one state to the other, thus con-
serving energy.
The difficulty with this type of relay is that we cannot know which position they are, since with
both coils de-energized they may be in either position. Thus, to start the motor in one
direction, we must do the following:
Pulse the direction relay to the desired direction
Pulse the on-off relay to the on position
To stop the motor, we must do the following:
Pulse the on-off relay to the off position
The function for stopping the motor is very simple:
void StopMotor ( void )
{
COILS = STOP ;
WaitDelay ( COIL_PULSE ) ;
}
It energizes the appropriate coil, and starts the timer as described above. When the time has
elapsed, the current in the coil is switched off.
To start the m otor in one direction, the job is a little bit more complicated. To sim plify the
writing of the C source text, and make it more legible, a general function has been written. It
receives a message (four are possible) and acts as required. The message is made of a value
defined by an enumerated type:
enum eStates { START_CLOSE, START_OPEN, STOP_CLOSE, STOP_OPEN } ;
and the function handles that message according to its value:
void SwitchMotor ( enum eStates Direction )
{
LastDirection = Direction ;
switch ( Direction )
{
case STOP_OPEN:
Содержание 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 ...