276/317
9 - A Carrier-current System for domestIc Remote Control
The relay coils are driven by MOS transistors, since the current specification of the parallel
port does not allow for direct connection of the coil to the port. The pull-down resistors guar-
antee that at power on, no coil is powered, allowing the ST7 to start with enough power and
preventing undue activation of the motor.
The motor has a three-terminal winding with a phase shift capacitor connected across two of
them. The circuit below the motor rectifies the voltage present at both of these ends. The D.C.
voltage produced remains within 5 V, and is connected to one input of the Analog to Digital
Converter. When the motor is still, the voltage rectified corresponds to the line voltage, here
230 VAC. This gives a voltage of about 2.5 VDC at the output of the rectifier. W hen the motor
is running, the unconnected term inal has a voltage much higher than that, relative to the
common terminal. This produces a higher D.C. voltage to the converter, and using an appro-
priate threshold, the microcontroller can detect when the motor is running and when it has
been stopped by one of its integral end-of-travel switches.
9.3.3 Software
9.3.3.1 Interrupt functions
The receiver works basically like the transmitter. Timer A is used to produce an interrupt every
half cycle of the power line (10 ms at 50 Hz), and it is synchronized with the line voltage using
a phase-lock-loop technique. Only the parameters differ from that of the transmitter, because
the internal clock is slower and the interrupts must occur once instead of three times per half-
cycle.
When the interrupt occurs, the OCF1 bit of the TASR register is checked to see if it is a capture
interrupt or a timer overflow. In the latter case, the
ReceiveOneFrameElement
function is
called. The code of this function is given below:
void ReceiveOneFrameElement ( void )
{
static Byte TempHouseCode, TempKeyCode, TempHouseCode2, TempKeyCode2,
CarrierDetected ;
/* First determine if carrier is present */
CarrierDetected = ( ReadADC ( CARRIER_ADC_CHANNEL ) >
CARRIER_THRESHOLD ) ;
switch ( Cycl+ )
/* Increment counter just after test */
{
case 23 :
TempHouseCode2 = TempHouseCode ;
/* Keep command received
in 1st frame. */
TempKeyCode2 = TempKeyCode ;
case 1 :
case 2 :
case 3 :
Содержание 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 ...