![]() ZBasic System Library
346
ZBasic Microcontrollers
Type
Subroutine
Invocation
X10Cmd(outPin, syncPin, house, devCmd, count)
X10Cmd(outPin, syncPin, house, devCmd, count, flags)
Parameter
Method
Type
Description
outPin
ByVal
Byte
The pin on which the X10 signal will be generated.
syncPin
ByVal
Byte
The pin on which the 60Hz sync signal will be received.
house
ByVal
Byte
The house code.
devCmd
ByVal
Byte
The device code or command code.
count
ByVal
Byte
The number of times to repeat the transmission.
flags
ByVal
Byte
Flag bits to control the operation of the command.
Discussion
This routine produces an X-10 compatible signal on the pin specified by outPin. The signal is
synchronized to the zero-crossing signal on the pin specified by syncPin. The generated signal will
include the specified house code and command/device code and will be repeated the specified number of
times without any spacing between the code sequences. The X-10 specification indicates that most
commands should be repeated twice and that successive commands should be separated by at least 3
power line cycles (~50 milliseconds). The exception is for bright and dim commands that can be repeated
any number of times.
If the flags parameter is not present, the transmission is implemented as a single 1millisecond pulse
near the edge of the zero crossing signal. If the flags parameter is present it has the effects shown in
the table below depending on the value of the parameter.
Function
Hex Value
Bit Mask
Three-phase output
&H01
xx xx xx x1
50Hz timing
&H02
xx xx xx 1x
If the three-phase output flag bit is asserted, three 1 millisecond pulses will be output during each half-
cycle. The 50Hz timing flag is used to control the phase timing of the three-phase output. If the flag bit is
not asserted, 60Hz timing is utilized. This flag bit is only used when generating three-phase output.
External Circuitry
In order to control X-10 devices, you will need a power line interface device such as the PL513 or the
TW523, both of which are available from a variety of sources. The technical documentation for both
interface devices is available on the Internet. A simplified interface between the ZX and the PL513 is
shown below. Note that this circuit will not work for the TW523. The suggested OEM circuit in the X10
Technical Note, or something similar, should be used.
|