|
Intro to Physical Computing Syllabus code, circuits, & construction
|
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:
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:
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.
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. |