Datasheet
Jon Waddington
25
contain the house code and the 4 least significant bits contain the device code or the
function code.
The checksum is calculated by calculating the sum of the first 2 bytes. This is then
transmitted to the Propeller which confirms that the data is correct by transmitting an
acknowledge byte of ‘0x00’. When the CM12 is ready to receive again it transmits ‘0x55’
to the Propeller.
The SPIN code below shows a method which handles the full transmission with the CM12
controller. The device code and function code are passed into the method and the
Simple_Serial object is used to transmit and receive the signals from the CM12.
PUB do(device, function) | rx
{method to perform a function on X10 devices}
repeat until rx == (($04 + (housecode + device))& $FF) 'repeat until correct
checksum received
serial.tx($04) 'transmit header
serial.tx(housecode + device) 'transmit code
rx := serial.rx 'receive checksum
if rx == $A5 'if controller is polling system
serial.tx($C3) 'respond to polling
serial.tx($00) 'send acknowledgement of checksum
repeat until rx == $55 'wait until 'ready to receive' is received
rx := serial.rx
repeat until rx == (($06 + (housecode + function))& $FF) 'repeat until correct
checksum received
serial.tx($06) 'transmit code
serial.tx(housecode + function) 'transmit code
rx := serial.rx 'receive checksum
serial.tx($00) 'send acknowledgement of checksum
repeat until rx := $55 'wait until 'ready to receive' is received
rx := serial.rx
When the CM12 receives data from the power-line, it begins to poll the Propeller to
upload its buffer. The poll signal is a byte (0xA5) which is transmitted once every second
until the Propeller responds by transmitting a byte with the value of ‘0xC3’. While the
CM12 is polling the Propeller, a transmission cannot take place.
Figure 3.4.3.2 shows the binary house codes and address codes which are assigned to
the X10 devices [33]. Figure 3.4.3.3 shows the binary function codes which are
transmitted to the previously addressed X10 device to perform a desired function [33].










