SPLatco Knowledge Base

The basic principle of this “SPiceX” technique is that you maintain an image of the expansion inputs and outputs in RAM (data memory) and then bulk transfer them between the controller and the expansion board using special instructions. Within RAM each input and output point will be represented by a single bit of data. Hence, to for example change an output pin you would first alter the corresponding bit in RAM (the semaphore instructions can be very handy for this!) and then you would transfer the RAM data to the actual expansion boards.

Note that with this technique it is not possible to update a single output pin (or read a single input pin) individually. You must update (refresh) the whole lot (every bit in every expansion board) every time. That’s why you keep an image of all outputs in RAM, and transfer them all out every time you need to update even one single output pin. In theory you could access inputs pseudo-randomly by doing a total read each time and picking out the bit you want. In practice it usually is simpler to read in the whole lot periodically and then pick the bits you want out of RAM.

The principle instruction used for transferring data between the controller and the expansion board is called SPxTxfrU. That instruction transfers a number of bytes out of the U register and out to the expansion boards (as outputs) and at the same time transfers the same number of inputs from the boards and leaves them in U. The number of bytes transferred is set by the number pre-loaded into the V register. The transfer always starts at U0.

The U register is described under “SPx Register Model” in the SPLat Expansion Framework documentation. In brief it is a register consisting of 20 bytes of information (this may grow in the future). It is used for a variety of data transfers between the SPLat controller and external devices, and in the future is likely to find other uses. Associated with U is the V register. V is a single byte register that is usually used as a byte counter to determine how many bytes of U are being transferred.

The SPxTxfrU instruction has an argument p. In all existing implementations use p=0, i.e. SPxTxfrU 0.