SPLatco Knowledge Base

Note: The program includes data block definitions and Xwire tables for the Date and Time addresses in the SX10509. No use is made of the date and time in this sandbox application, but the configuration code has been left in the actual program to provide you with an example for your own applications.

Xwire data blocks

The program uses Xwire to communicate with the SX10509. Xwire requires separate Tx (transmit) and Rx (receive) data blocks in RAM for each Xwire address. These are defined in the following lines, which set aside RAM:

;---- For Tx
kTxNetLength     EQU      32
                 defBLOCK 32         ;transmit data block
bTxCmd           defBYTE             ;command (bit 7 toggles the next iteration of the current command)
bTxLength        defBYTE             ;length of transmit data
kTxDataLen       EQU      30
abTxData         defBYTE  30         ;transmit data
;
;---- For Rx
kRxNetLength     EQU      32
                 defBLOCK 32         ;receive data block (chose 32 as this is the SCH default)
bRxCmdEcho       defBYTE             ;copy (echo) of the last completed command (will match bTxCmd when done)
bRxLength        defBYTE             ;receive data length
kRxDataLen       EQU      30
abRxData         defBYTE  30         ;received data

For the Tx, we set aside a block of 32 bytes of RAM. The first byte we name bTxCmd. This is where we will store commands to the SX10509. The SX10509 will respond each time that byte changes. The second byte we name bTxLength. For data transfers to the SX10509 this is set to the number of data bytes we are sending it. At the 3rd byte we set aside 30 bytes, naming the first one abTxData. This is where we can store up to 30 bytes of data to be sent to the SX10509.

For the Rx, the structure is very similar. When in use, the SX10509 will set the byte bRxCmdEcho to reflect the command just processed. If processing involves a round trip to a remote server, this could take some time.

NVEM table for Xwire communication to the SX10509

The NVEM table tells the SPLat how to communicate with the SX10509 via Xwire. This is a pretty standard Xwire master configuration table.

pXWireConfig:
   ;SCH Xwire NETWORK configuration
   NV0Byte     64                      ;Address of the SPLat Call Home board
   NV0Byte     bTxCmd                  ;Address of the Tx data block
   NV0Byte     kTxNetLength            ;Length of the Tx data block
   NV0Byte     bRxCmdEcho              ;Address of the Rx data block
   NV0Byte     kRxNetLength            ;Length of the Rx data block

   NV0Byte     255                     ;XWire config end of table marker