EasyManua.ls Logo

ST ST7 - Page 264

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...
264/317
9 - A Carrier-current System for domestIc Remote Control
The next five pairs of bits carry the Key Code, and work exactly the same way as for the House
Code.
Since the whole process above must be repeated, all the
case tags are duplicated with an
offset of 22.
When
CycleNumber reaches 45, the frame is finished. The output is turned off, to silence the
transmitter. As three cycles are required between two successive transmissions, six more in-
terrupts are processed, though they do nothing. On the 50
th
interrupt, CycleNumber is reset to
zero to mean that no transmission is in progress. This condition is tested in the main program,
that will not attempt to send a message while one is in progress. Please note that the low-
order bit is sent first.
Thesourcecodeisthefollowing:
/* This function is the frame transmission procedure. It is called when
*/
/* a time element of a frame is to be sent, that is, 2 times per line
cycle. */
void SendOneFrameElement ( void )
{
static Byte TempKeyCode, TempHouseCode ;
switch ( CycleNumber++ ) /* Increment counter just after test */
{
case 1 : /* First 3 half cycles must have a pulse (start
condition) */
case 23 : /* Start of second group */
TempKeyCode = KeyCode ;
TempHouseCode = HouseCode ;
TACR1 |=(1<<OLVL1 ) ; /* Validate pulse for next
interrupt */
break ;
case 2 : /* Second and third pulses of start code (1st group) */
case 3 :
case 24 : /* Second and third pulses of start code (2nd group) */
case 25 :
break ;
case 4 : /* 4th half cycle must have no pulse ; end of start */
case 26 :
TACR1 &= ~( 1 << OLVL1 ) ; /* Invalidate pulse for next
interrupt */
break ;
case 5 :
case 7 :
case 9 : /* Transmit one of the four bits of house code */
case 11 :
case 27 :

Table of Contents

Related product manuals