EasyManua.ls Logo

ST ST7 - Page 266

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
266/317
9 - A Carrier-current System for domestIc Remote Control
case 36 :
case 38 :
case 40 :
case 42 :
case 44 :
if ( ( TempKeyCode&1)==0)
TACR1 |= ( 1 << OLVL1 ) ; /* Validate pulse for next
interrupt */
else
TACR1 &= ~( 1 << OLVL1 ) ; /* Invalidate pulse for next
interrupt */
TempKeyCode >>= 1 ; /* Finished with this bit. Ready for
next bit */
break ;
case 45 :
TACR1 &= ~( 1 << OLVL1 ) ; /* Invalidate pulse for next
interrupt */
break ;
case 46 : /* Three full cycles of silence are required */
case 47 : /* before the next transmisson */
case 48 :
case 49 :
break ;
case 50 :
CycleNumber=0; /*Reset cycle counter to terminate
stream */
break ; /* and re-enable the transmission. */
}
}
The basic structure is a switch statement that jumps to the piece of code related to the current
bit number. This number is incremented just after it is tested, so that it travels from 1 to 23.
Then, it is set to zero. When it is zero, the common interrupt service routine does not call
Sen-
dOneFrameElement
any more until CycleNumber is set to 1 again by the SendCommand func-
tion.
switch ( CycleNumber++ ) /* Increment counter just after test */
{
case 1 : /* First 3 half cycles must have a pulse (start
condition) */
Each word to send (House Codeand Key Code) is shifted right after the rightmost bit has been
picked. According to the state of this bit, the OLVL1 bit in the TACR1 register is either set or
reset, to generate a pulse or no pulse. This is done by this block of statements:

Table of Contents

Related product manuals