The X-10 and IR Node
This node actually combines four functions in one very busy box:
The serial interfaceThe PIC16C74 has one hardware UART. This is assigned to the 485 port on this box. A software UART is implemented and connected to the 232 port. All characters are echoed from one port to the other, and then used internally to decode network messages.
The LCD panelI use a 2x16 line LCD panel from EPSON. This uses the industry standard Sharp 44780 Controller, and code examples exists in several places. It was difficult at first getting the timing right, but the result have been successful. The network address of the LCD module is 'L'. The 'data' field of the network message will be displayed in the LCD window, allowing any node to display a message on the window. For example, sending the following message over the network:
Displays "Hello" on the LCD screen, then the LCD sends an ACK back. By the way, the address of the sender of the message above is 'C', which is the central controller or PC.
The Infra Red interfaceThe PIC controls a oscillator and driver that flashes an IR led via a jack on the box's rear panel. There is also a Sharp IR cube that demodulates the raw IR signal to TTL level pulses. The software module has been written to send and receive the Sony SIRCS protocol.
The IR module's address is 'I', and it can accept commands or requests for sampled IR data. For example, the network command:
Causes the software module to respond with the most recently sampled IR command. The network command:
Causes the module to send a function code 17 to device code 1, and then return an ACK. This command turns up the volume on my TV.
The X-10 interfaceThis software module is connected to an X-10 TW523 module; its address is 'X'. For example, the following network command:
May cause the software module to return:
Meaning that the oldest received X-10 command is A-1. The software module buffers up 30 X-10 commands in a fifo, sending the oldest one first. This way the main controller can query the X-10 interface at its convenience, and messages will not be lost.