Tom's Main Menu

Physical Computing Home

Intro to Physical Computing Syllabus

Networked Objects

Sustainable Practices

blog

Resources

code, circuits, & construction

my del.icio.us links

 

Siteplayer's Special Function Registers

 
Like most microprocessors, Siteplayer has a set of memory registers that are reserved for special functions of the processor. By changing the values of these registers, you can enable various functions, read inputs, and control outputs. Like variables, special function registers have a specific address in memory. Most of the common functions also have names given them in the pcadef.inc file, so you can refer to them just like variables.

The siteplayer software manual covers all of the special functions in detail. This page will mention a only a few of them as examples of using the special function registers.

Input/Output Pin Registers

The I/O pins have the following addresses:

Address Name Description Pin number
0FF11h IO0 Port 1 Bit number 0 11
0FF12h IO1 Port 1 Bit number 1 12
0FF13h IO2 Port 1 Bit number 2 13
0FF14h IO3 Port 1 Bit number 3 14
0FF15h IO4 Port 1 Bit number 4 15
0FF16h IO5 Port 1 Bit number 5 16
0FF17h IO6 Port 1 Bit number 6 17
0FF18h IO7 Port 1 Bit number 7 18

If you wanted a hyperlink to set I/O pin 0 (pin 11) high, you would write it in your HTML as follows:

<A HREF="myspi.spi?IO0=1">turn on pin 11</A>

If you wanted to show the state of the I/O pins in your HTML code, you would write it as follows:

Pin 11 = ^IO0
Pin 12 = ^OI1
Pin 13 = ^IO2
Pin 14 = ^IO3
Pin 15 = ^IO4
Pin 16 = ^IO5
Pin 17 = ^IO6
Pin 18 = ^IO7

When the siteplayer serves the page to the client, it checks the states of the I/O registers, and fills in the appropriate values (1 or 0) for the variable names (^IO0 through ^IO7) in the HTML.

Serial Port Registers

The serial port output registers are as follows:

Address Name Description
0FF19h COM Serial port output
0FF1Ah Baud Baud Rate Object

Any value you put in the COM register automatically gets sent out the serial port. This is the easiest way to send info from links out the serial port to another microprocessor. You should set the baud rate for your serial port in your .spd file, so the siteplayer defaults to the baudrate you want it at. The formula for calculating the baudrate can be found in the siteplayer software manual. It defaults to 9600 baud.

Details on the serial port, including how to make the siteplayer receive serial data, can be found on the serial page.

UDP registers

The UDP send function has a number of registers associated with it. The details of who to send to, and what to send, are put into these registers before sending a command.

Address Name Description
02D0h UDPMAC 1st of 6 bytes for Destination MAC address
02D1h UDPMAC2 2nd of 6 bytes for Destination MAC address
02D2h UDPMAC3 3rd of 6 bytes for Destination MAC address
02D3h UDPMAC4 4th of 6 bytes for Destination MAC address
02D4h UDPMAC5 5th of 6 bytes for Destination MAC address
02D5h UDPMAC6 6th of 6 bytes for Destination MAC address
02D6h UDPIP 1st of 4 bytes for Destination IP address
02D7h UDPIP2 2nd of 4 bytes for Destination IP address
02D8h UDPIP3 3rd of 4 bytes for Destination IP address
02D9h UDPIP4 4th of 4 bytes for Destination IP address
02DAh UDPPORT 2 bytes for Destination Port address
02DCh UPDADDR 2 bytes for Starting Memory Address of object(s) to send
02DEh UDPCOUNT 2 bytes for Count of bytes to send 1-768

It may seem like a lot of information just to send a message, but it's not really so bad. All you're doing is composing an ethernet address to send to, composing an IP address to send to (like 128.122.151.192), setting a port to send to, then saying what variable to send, and how many bytes of the siteplayer's memory to send. See the UDP notes for more details.

Other Registers

Though these are the most commonly used, there are other special function registers besides these, that have a similar structure. Each will have an address, a name, and a function that is executed depending on the value you put in the register. See the siteplayer software manual for the details on each one.