circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 113 December 1999
Being Cool is Easy
A Temperature-Sensing Control Device


POWER LINE INTERFACE

The TW-523 interface is used to send and receive X-10 codes via the AC power line. A technical note is available online from X-10. For those of you who are long-time subscribers to Circuit Cellar, the X-10 protocol and theTW-523 module were described by Ken Davidson in issues 3 and 5.

An X-10 command consists of a start code, a House Code, and a Key or Function Code. Transmission of each command requires 11 power line cycles: two for the Start Code, four for the House Code, and five for the Key or Function Code.

Each command is transmitted twice with at least three power line cycles between pairs. The four House Code bits and the five Key or Function Code bits are transmitted in true and complement form on alternating half cycles of the power line.

Here’s an example. To turn on unit 5 of House Code G requires the following X-10 commands:

 

Start Code (1110), House Code G (0101), Key Code 5 (00010)

Start Code (1110), House Code G (0101), ON Function Code (00101)

Figure 5 illustrates the transmission of these two X-10 commands. The House Code, Key and Function Code encoding is defined in the X-10 technical note.

(Click here to enlarge)

Figure 5—Transmission of each X-10 command requires 11 power line cycles. Each command is transmitted twice with three or more cycles between pairs.

ZERO CROSSING DETECT

The X-10 transmission must be synchronized with zero crossing on each half cycle of the power line. This is the point when the AC voltage goes from positive to negative or from negative to positive. The TW-523 provides a zero-crossing output. This output is a 60-Hz square wave and is connected to the 16C73A RB0/INT pin.

The X-10 sensor software configures the RB0/INT pin to generate an interrupt. RB0/INT can be configured to select either the rising edge or the falling edge. An interrupt on both edges is desirable and is achieved by toggling the edge select (INTEDG bit in the ’16C73A OPTION register) just after each zero-crossing interrupt.

The software uses the ’16C73A Timer0 in combination with the zero-crossing interrupt to provide the precise timing necessary for sampling of incoming and gating of outgoing X-10 commands. This timing sequence is illustrated in Figure 6 and described in more detail in the following sections.

The zero-crossing interrupt is also used to blink the heartbeat LED (LED2) at a 1-Hz rate, which provides a warm fuzzy indication that the temperature sensor and TW-523 module are alive and well.

RECEIVING REQUESTS

Each X-10 command is transmitted twice. The TW-523 only provides the second of the two transmissions via its Rx output. The Rx output is valid between 500 and 700 µs after zero crossing. The software sets up Timer0 to generate six interrupts after each zero crossing. The first Timer0 interrupt occurs at 600 µs after zero crossing and the Rx output is sampled at this time.

Remember that it takes 11 power line cycles or 22 zero-crossing events for a complete X-10 transmission. Four samples are required for the Start Code, eight samples for the House Code, and 10 for the Key or Function Code.

The temperature sensor looks for a consistent X-10 transmission which consists of:

 

• valid start code: 1 1 1 0

• four House Code bits in true and complement form

• five Key or Function Code bits in true or complement form

The incoming X-10 command and any earlier received commands are discarded if any inconsistencies are detected and the software starts over looking for a valid start code.