circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 151 February 2003
Working the ’Net


COM SPI WITH ME

Besides user-defined objects like variables, SitePlayer offers a number of built-in objects that you can access. These include various ’51 resources such as the on-chip special function registers and I/O lines along with higher-level objects like COM and SPI. The former provides easy access to the ’51’s UART. For instance, referring back to Photo 3, clicking on Hello invokes a link that looks like:

<A HREF="comtest.spi?com= Hello%20World%0d%0a" >Hello</A>

which sends the Hello World string followed by a carriage return and line feed out the UART.

Meanwhile, the SPI object provides, as you might have guessed, access to SPI peripheral ICs. When using the SPI object, three of the eight available SitePlayer ’51 I/O lines take on the clocked serial role (i.e., SCK, MOSI, and MISO) with any or all of the remaining five lines used as SPI chip selects. The manual contains examples of the admittedly cryptic HTML needed to perform a SPI access, but also explains that you may have to get your hands dirty (e.g., Java) to make much use of the cascade of bits associated with a particular peripheral chip.

There’s even a universal datagram protocol (UDP) object that allows your device to send, receive, and broadcast packets to other UDP-capable devices, including, of course, other SitePlayers. Just remember that unlike TCP/IP, with UDP there are few guarantees in terms of delivery and correctness, so you’ll have to harden your application against the possibility of network errors.