Previous Topic

Next Topic

Book Contents

Book Index

Xwire: Addressing

In a system with Xwire master and one or more slaves, you need a policy and a technique for allocating addresses to the slaves. In this context the address is what is used by the master to distinguish one slave from another. Every slave must have an address (even if you only have one slave), each slave must have a different address, and the master must be pre-programmed with the correct addresses.

What addresses to allocate

Xwire slaves can be either SPLat controllers (typically a CC18) that you have programmed to be an Xwire slave, or dedicated Xwire peripheral boards that we have made to be Xwire slaves, for example SX10500. Legal Xwire slave addresses are 0 through 253. The master does not have an address. Within that range you can allocate addresses however you see fit consistent with any constraints that may exist within individual slaves (i.e. not all slaves are readily able to take on all addresses).

Xwire peripheral products

If you are using an Xwire peripheral, you should first read up on its documentation to determine available addresses for that particular product. For example, the SX10500 has 8 possible legal addresses, and it has 3 jumpers for selecting one of those addresses.

SPLat controller programmed to be a Xwire slave

If you are using a SPLat controller, like the CC18, you must set its Xwire address using a XwireSetAddr instruction. That instruction takes whatever number is in the X register and makes it the Xwire address of the board.

How that number gets into X is a separate issue. There are several possibilities for the instruction preceding the XwireSetAddr:

  1. You simple use a fixed number with an instruction like LoadX 5:

    LoadX 5

    XwireSetAddr

  2. For the CC18, which has a pair of jumpers, labeled A0 and A1, intended just for this application, you read the jumpers into X using XwireGetJumpers:

    XwireGetJumpers

    XwireSetAddr

  3. You read a number of inputs that have been dedicated to address selection, typically using an InputFM instruction. In this case you would also use an AndM to select the bits being used. For example, say inputs 13 and 14 are used for address selection:

    InputFM 13 ;Read 8 inputs starting at 13

    LoadX %00000011 ;Bit mask to select just inputs 13 and 14

    AndM ;Bit-wise And between the inputs and the mask

    XwireSetAddr

    Note that inputs 13 and 14 are the option jumpers on an MMi202. Note also that they are typically available for use only if there is not a SPice board mounted on the MMi202.

  4. If the slave is a controller with a user interface, like an MS120, you might have a menu item that sets its address. That is definitely an advanced topic and I won't try to expand on it any further here.

Previous Topic

Next Topic