SPice10211: Programming
Once installed on a SPLat controller, the SPice10211 appears as several regular analog and digital I/O points. The following table shows the mappings for all the I/O on the board. Numbers in parenthesis are the numeric analog channel numbers used with fAnIn and fAnOut.
| Cnctr pin | SLXXX | MMiXXX | MS12X | ||
|---|---|---|---|---|---|
| Analog input 1 | 4 | AnInC (2) | AnInE (4) | AnInC (2) | |
| Analog input 2 | 5 | AnInD (3) | AnInF (5) | AnInD (3) | |
| Analog output 1 | 8 | AnOutH (7) | AnOutJ (9) | AnOutJ (9) | |
| Thermistor drive voltage | 9 | AnOutG (6) | AnOutI (8) | AnOutI (8) | |
| Trim 1 | 7 | AnInF (5) | AnInH (7) | AnInF (5) | |
| Trim 2 | 6 | AnInE (4) | AnInG (6) | AnInE (4) |
initializing the SPice connector
Because the pins of the SPice connector, to which the SPice10211 is connected, can be configured for different functions (analog/digital, input/output), you need to have some code in your program that configures them to the correct settings for the SPice12011.
The following section of code should be run by your program just once, at the beginning, before your program attempts to do anything else with the SPice10211.
ClrU setu 0,3 ;set spice connector pin 4 as analogue input setu 1,3 ;set spice connector pin 5 as analogue input setu 2,3 ;set spice connector pin 6 as analogue input setu 3,3 ;set spice connector pin 7 as analogue input setu 4,4 ;set spice connector pin 8 as analog output setu 5,4 ;set spice connector pin 9 as analog output SpiceConfigU
If you are using a thermistor circuit you will also need to initialize the thermistor drive voltage to the required value with code like this:
LoadX XXX AnOutZZZ
In this code replace XXX with the Vfeed value required. You will generate this when you work through the thermistor temperature measurement tutorial. On the SPice10211 the Vfeed range is 0 to 20V (representing XXX = 0 to 255).
Note: The maximum Vfeed value you can use is limited by the supply voltage to the board. The Vfeed generator can at most get to about 2V less than the supply voltage. Hence, with say a 12V supply you can at best design for a 10V Vfeed (XXX=127). If you are using an unregulated supply you must take into account voltage variations and ripple. With a 24V regulated supply you will be able to use the full Vfeed range up to 20V.
Replace ZZZ with the analog output pin used for Vfeed (see table above).
Programming the thermistor inputs
If you are using the thermistor temperature measurement feature you must initialize the drive voltage as described above. Thereafter you get a raw reading from the thermistor into X using the appropriate Anin instruction in the table above. The thermistor temperature measurement tutorial shows you how to convert the raw readings into temperatures.
After initialization there will be a delay before the Vfeed voltage settles down. Your program should not perform any control action based on a temperature reading for at least 500mS after initialization.
Note that during debug with SPLat the SPice board may not show up correctly in the I/O window unless the board has run the initialize code. You can fix this by translating and running the above initialization sequence in the board. Add a line
a goto a
at the end to prevent translation and runtime errors.
Programming the potentiometers
The potentiometers simply appear as two analog inputs.
