The sample program presented here works with the sandbox. Please play with the sandbox from your browser to get a feel for it, and make sure your SX10509 is configured as described above, before proceeding.
The program is too large to present and describe all in one hit. I will therefore describe its development in small steps, and gradually "glue them together" to form the completed program.
You can download the whole program here: sandbox1.spt. If you wish, you can download it and run it now, to see what it does. You will need:
Open the program in SPLat/PC. At the top is a section labelled I/O Assignments. This has two groups of definitions, one for MMi202 and one for MS120. "Uncomment" the lines that match your board, and Comment out, or delete, the other group. If you have a custom SPLat, you will need to create your own assignments. Use some regular digital inputs if your controller has no push buttons. You actually only need 3. Contact your regular support engineer if in doubt.
Identify the physical inputs (push buttons) corresponding to iBtnA, iBtnB, and iBtnC.
Translate the program, download it to the controller, and set it running (This will not work in simulation!). The program should identify itself on the screen.
Log on to the sandbox page if you are not already there.
Now the big test: Press button A. If it all works, the time in GMT should show on your LCD, and the sandbox page should show what was sent from the SX10509 and what was sent back.
If this fails, re-check your connections, make sure the SX10509 is plugged into a working Internet connection and that its activity lights are flashing.
If that fails, connect to the SX10509 from your browser and select the Status tab. When you push a button you should see activity in the data windows. If not, double check the Xwire connections and the Xwire configuration.
If you cannot connect to the SX10509, you most likely have a network problem. See your network administrator.
Once you have button A responding, try the other buttons. Button B will simply display -4. Button C will display data from the Simulated Application part of the sandbox. When you change that data you must click the Save button on the web page before it can be sent to the SX10509. The Pump and Valve settings are displayed on front panel LEDs.
Experiment with changing the data in the Simulated Application.
In the following pages I will take you through the sample program a bit at a time. I will introduce it from the bottom up, so you can be sure to understand the programming techniques used, as well as the big picture.