88 of 323
ZBasic System Library 78 ZX Microcontroller Family DefineX10 Type Subroutine Invocation DefineX10(channel, rxPin, txPin, flags) DefineX10(channel, rxPin, txPin, flags, agcResetPin, agcWindowPin) Parameter Method Type Description channel ByVal Byte The X-10 channel being defined. The valid range is 1-2. rxPin ByVal Byte The pin which will serve as the receive line. txPin ByVal Byte The pin which will serve as the transmit line. flags ByVal Byte Configuration flags. See the discussion below. agcResetPin ByVal Byte The pin on which to generate the AGC reset signal. agcWindowPin ByVal Byte The pin on which to generate the AGC window signal. Discussion This routine configures an X-10 communication channel, preparing it to be opened using OpenX10(). If the specified channel is already open, this routine does nothing. Likewise if the specified channel is invalid or if both the rxPin and txPin parameters are zero or invalid. Note that either rxPin or txPin may be zero, allowing you to define a transmit-only or a receive-only X-10 channel. If valid, the pins specified by rxPin and txPin are automatically configured as input and output, respectively. The flags parameter contains several bit fields used to specify some of the details of the operation of the X-10 channel. Configuration Flags Bit Values Function Hex Value Bit Mask LSB-first Transmit Bit Order &H08 xx xx 1x xx MSB-first Transmit Bit Order &H00 xx xx 0x xx Inverted Transmit Logic &H04 xx xx x1 xx Non-inverted Transmit Logic &H00 xx xx x0 xx LSB-first Receive Bit Order &H02 xx xx xx 1x MSB-first Receive Bit Order &H00 xx xx xx 0x Inverted Receive Logic &H01 xx xx xx x1 Non-inverted Receive Logic &H00 xx xx xx x0 The remaining bits are currently undefined but may be employed in the future. When non-inverted modes are selected, the idle state of the transmit line or receive line will be logic 0. Whether you should choose the inverted or non-inverted mode depends on the interface circuitry that you use to connect to your X-10 transmitter/receiver. When LSB-first modes are selected, the first bit to be sent/received will be the least significant bit of each byte. This is useful when a Bit array is used to assemble/decompose the data that is sent/received since the lower-indexed bits in a byte are of lower significance. The second form with the additional parameters is provided for use with the CM15A and similar modules. The fifth parameter specifies a pin number on which to generate an active low signal to reset the CM15A AGC circuitry. The sixth parameter specifies a pin number on which to generate an active high signal marking the CM15A AGC window, approximately 1mS following each zero crossing. Example Call DefineX10(1, 0, 12, &H00)