30.11.2012 Views

The Internet Power Line Adapter - University of Queensland

The Internet Power Line Adapter - University of Queensland

The Internet Power Line Adapter - University of Queensland

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Home Automation, <strong>Power</strong> <strong>Line</strong>s and the <strong>Internet</strong> Quenten Alick<br />

STAB LENGTH * so store it in a variable<br />

CHECK2 LDAB LENGTH * check to see if the number<br />

<strong>of</strong><br />

INCB * packet received is equal to<br />

INCB * == length <strong>of</strong> data + first command<br />

byte + length byte<br />

CMPB RCVCNT * i.e is length + 2 = rcvcnt ?<br />

BNE DONE * if not then goto DONE<br />

* if the length <strong>of</strong> data + 2 is equal to the num <strong>of</strong><br />

packet receive<br />

* then do something here, like echo back.<br />

* turn on the transmit interrupt and disable the<br />

receive interrupt<br />

* note that TDRE is already set so once this routine<br />

is returned<br />

* it will call an interrupt<br />

LDAA #TRANSEN<br />

STAA SCCR2<br />

DONE LDY POINTER * increase<br />

INY * the index pointer<br />

STY POINTER * by one<br />

JMP RTRN<br />

*---------------------------------------<br />

* valid transmit interrupt<br />

*---------------------------------------<br />

TRANS LDAB LENGTH * check to see if the number<br />

<strong>of</strong><br />

- 49 -<br />

INCB * packet transmitted is equal to<br />

INCB * == length <strong>of</strong> data + first command<br />

byte + length byte<br />

CMPB TRNCNT * ie. is length + 2 = trncnt ?<br />

BNE MORE * if not then goto MORE<br />

* the entire message has been sent so disable the<br />

transmit interrupt<br />

* and enable the receive interrupt again.<br />

* for now just turn <strong>of</strong>f the entire thing<br />

* LDY STORE<br />

* STY POINTR2<br />

* CLR TRNCNT<br />

CLR SCCR2<br />

MORE LDY POINTR2 * get the message current<br />

location<br />

LDAB 0,Y * get the byte in the message<br />

STAB SCDR * store it in the data reg, this also<br />

clears TDRE<br />

INC TRNCNT * increase the transmitted byte<br />

count<br />

INY<br />

STY POINTR2<br />

RTRN RTI * return from int

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!