The Internet Power Line Adapter - University of Queensland
The Internet Power Line Adapter - University of Queensland
The Internet Power Line Adapter - University of Queensland
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Home Automation, <strong>Power</strong> <strong>Line</strong>s and the <strong>Internet</strong> Quenten Alick<br />
Chapter 5<br />
5.1 S<strong>of</strong>tware Implementation<br />
This chapter will look at the s<strong>of</strong>tware design issues that were considered for the<br />
system. <strong>The</strong>se design decisions will be looked at with reference to the<br />
specifications in chapter three and the restrictions imposed by the hardware<br />
chosen in chapter four.<br />
5.2 Microprocessor Code<br />
<strong>The</strong> first task that the code in both the client and server microprocessor must<br />
complete is the communications with the P300 network chip. <strong>The</strong>se<br />
communications require the use <strong>of</strong> the SPI interface on the microprocessor. <strong>The</strong><br />
format for data that is being sent to the P300 is a command byte, and length byte<br />
then zero or more bytes <strong>of</strong> data. A similar format is used for reading data from<br />
the P300. Firstly a command byte is sent by the microprocessor. <strong>The</strong>n the P300<br />
returns a length byte followed by the specified amount <strong>of</strong> data bytes.<br />
An interrupt driven transmission is the easiest way to transmit the data. In this<br />
format, the main body <strong>of</strong> the code initiates the transmission. Once the<br />
transmission has started, the SPI interrupt code in the microprocessor completes<br />
the rest <strong>of</strong> the transmission. <strong>The</strong> flowchart in figure 5-1 demonstrates the write<br />
operation [15]. <strong>The</strong> read operation is very similar to this. <strong>The</strong> main difference is<br />
that the microprocessor must feed in dummy data to generate a clock signal for<br />
the P300 to transmit its data out on.<br />
- 25 -