SPice 10200: Programming

Once installed on a SPLat controller, the SPice10200 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 MS12  
Conductivity 1 7 Input 10 Input 13 Input 20  
Conductivity 2 8 Input 11 Input 14 Input 21  
Thermistor 1 4 AnInC (2) AnInE (4) AnInC (2)  
Thermistor 2 5 AnInD (3) AnInF (5) AnInD (3)  
Thermistor 3 6 AnInE (4) AnInG (6) AnInE (4)  
Thermistor Vfeed 9 AnOutG (6) AnOutI (8) AnOutI (8)  

Initializing the SPice connector

Because the pins of the SPice connector, to which the SPice10200 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 SPice10200.

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 SPice10200.

         ClrU
         setu         0,3         ;set spice connector pin 4 as analog input
         setu         1,3         ;set spice connector pin 5 as analog input
         setu         2,3         ;set spice connector pin 6 as analog input
         setu         3,2         ;set spice connector pin 7 as digital input
         setu         4,2         ;set spice connector pin 8 as digital input
         setu         5,4         ;set spice connector pin 9 as analog output
         SpiceConfigU
         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 SPice10200 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. 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 fluid sensor (conductivity switch) inputs.

Once the board has been initialized, the fluid sensor inputs are just like any other input. The input will be on when there is fluid present.

Programming the thermistor inputs

Once the board has been initialized, the thermistor inputs appear as three analog inputs in the locations tabulated above. You get a raw reading from the thermistor into X using the AnIn instructions 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.