79 of 286
65 DefineX10 Type Subroutine Invocation DefineX10(channel, rxPin, txPin, flags) 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. 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. Example Call DefineX10(1, 0, 12, &H00) This call prepares channel 1 for transmit-only using pin 12, non-inverted logic, MSB-first operation. Compatibility This subroutine is not available on ZX models that are based on the ATmega32 processor (e.g. the ZX- 24). Moreover, it is not available in BasicX compatibility mode. See Also CloseX10, OpenX10, StatusX10