262/317
9 - A Carrier-current System for domestIc Remote Control
while ( CycleNumber != 0 ) ;
/* wait for end of transmission */
while ( Debounce () != 0 ) ;
/* wait for all buttons released */
}
}
Only those lines that are not self-explanatory have been commented.
9.2.3.2 Timer A Capture interrupt service routine
There are two different capture events that can occur for each timer. However, these events
share the same interrupt vector, so that the same interrupt service routine is called for either
event. The first task of the service routine is to determine which event produced the interrupt.
The common Timer A interrupt service routine.
Here is the code of the interrupt service routine:
#pragma TRAP_PROC SAVE_REGS
void TimerAInterrupt ( void )
{
WDGR = 0xFF ;
/* reload watchdog */
if ( TASR & ( 1 << ICF1 ) )
/* Determine which interrupt cause. */
{
/* This is a pseudo-capture 1 interrupt */
TAOC2HR = TimerAPeriod >> 8 ;
/* Set new period as calculated
in the capture */
TAOC2LR = TimerAPeriod & 0xff ;
/* interrupt service function.
High *MUST* be written first.
*/
asm
{
ld a, TAIC1LR ;
/* Dummy read to clear interrupt request */
}
if ( CycleNumber != 0 )
/* transmission is in progress if
not zero */
{
if ( Phase == 0 )
SendOneFrameElement () ;
/* Change element every 3
interrupts. */
Phase++ ;
/* increment phase for next time */
if ( Phase > 2 )
Phase = 0 ;
/* 0, 1, 2, 0, 1, 2 ... */
}
}
else
{
/* This is a capture 2 interrupt. */
PhaseLockedLoop () ;
/* The interrupt request is cleared there by the read at TAIC2LR */
}
}
Содержание 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 ...