This section provides details of how you exchange data and commands between a SPLat controller and a server, via the SX10509. This page provides an overview of the process, while subsequent pages provide more specific details.
The SX10509 SPLat Call Home module is able to perform either GET or POST requests under control of the SPLat program in your controller.
The simplest method of configuring the server URL is to enter the server domain, port and script path in the Server Configuration tab.
Data is sent to and from a server, via the SX10509, at the Xwire address which is set via "Network Address" in the Xwire Configuration tab. This is 64 by default.
Both the Xwire network transmit and receive data blocks may be between 3 and 32 bytes long. Use the longest you can afford for each, based on the amount of spare RAM you have.
The length of your transmit data block is automatically detected by the SX10509, but the length of your receive buffer must be entered on the Xwire Configuration tab. By default, this is set to 32 bytes.
To get some data from the SPLat controller to the server, you first have to send it to the SX10509 board, and then command the SX10509 to send it to the server (usually with a GET or POST request). To get some data from the server you have to command the SX10509 to request it from the server (usually with a GET or POST request), and then read the resulting data out of the SX10509.
The basic steps for sending something to the SX10509 board via Xwire are:
TxCommand byte) to the command that tells the SX10509 what to do with the string. It is important that the command byte is set last.The SX10509 will process a command only when the command byte in byte 0 of the network transmit block is different to the last/previously processed command. You force the SX10509 to process several commands of the same type by toggling bit 7 of the command byte. The SPLat program should always wait for the echo (the identical command byte) to appear in byte 0 of the network receive block before moving on to a subsequent command. If the command involves sending something to the server, which could be the other side of the world, this could take some time.
The SX10509 contains a 256 byte RAM buffer for holding data that is to be sent to the server. Because the Xwire link between the SPLat controller and the SX10509 can only transfer a maximum of 30 bytes at a time, you may need to load up the server transmit buffer in several Xwire transfers. Each Write command appends its data to the buffer, except a Write of zero bytes, which clears the buffer.
Transferring data from the SPLat controller to the server (via the SX10509)
The basic steps for sending some data to the server are:
iiPrintText and iifPrintWFW instructions, along with appropriate field delimiters, and then send it to the SX10509's server transmit buffer with a Write command.The basic steps for extracting server data back from the SX10509 to the controller are:
iifGetNum, which converts an ASCII numeric string such as "3.1415" to a floating point number in W, and iiGetHex.Hint: When designing the server script, it is much safer and easier to use ASCII number representation than pure binary numbers.
The identity of the server that the SX10509 will communicate with is stored in the SX10509. This information can be configured into the SX10509 during system setup. It can also be changed dynamically via Network commands. Once you understand how to send and receive data, changing the server configuration programmatically will be simple.