SPice configuration instruction
There is one special SPLat instruction associated with Touch of SPice boards.
SPiceConfigU
This is used where the SPice pins are configurable as to their functions. It uses the contents of U to configure the SPice pins. The number in U(0) configures the first pin, the number in U(1) configures the second pin etc. The values are:
0 = No change. The pins configuration remains unaltered
1 = Digital Output
2 = Digital Input
3 = Analog Input
4 = Pulse Width Modulated (PWM) Output
5 = Digital Bidirectional
6 = Counting Input
Other numbers could also apply. This mechanism is entirely a function of the individual SPLat board, so you need to refer to the documentation for the board you are using. The definition of pin numbers is also product dependent (but will not necessarily be the same as I/O numbers).
Here's an example of configuring the SPice pins for a SP10213 DC Motor Control board
;I/O assignment (MMi203)
;-- digital outputs --
oDirection oEQU 16
;-- analogue outputs --
aoMotorSpeed EQU 9
;SPICE configuration values, ref SpiceConfigU
SPICEkUnchanged #EQU 0 ;No change. The pins configuration remains unaltered
SPICEkDOut #EQU 1 ;Digital Output
SPICEkDIn #EQU 2 ;Digital Input
SPICEkAIn #EQU 3 ;Analog Input
SPICEkAOut #EQU 4 ;Pulse Width Modulated (PWM) Output
SPICEkBIO #EQU 5 ;Digital Bidirectional
SPICEkCounter #EQU 6 ;Counting Input
;configuration code
SetU 0,SPICEkDOut ;direction relay
SetU 1,SPICEkUnchanged
SetU 2,SPICEkUnchanged
SetU 3,SPICEkUnchanged
SetU 4,SPICEkAOut ;motor speed
SetU 5,SPICEkUnchanged
SpiceConfigU