Controller Communications

Hardware

The host, an IBM PC compatible, will communicate with the controllers through the serial port. In the current design, the port connections go to 2 lines on each PIC. The PICs, thus, sit directly on the RS-232 bus. In future this may be replaced by an I2C based bus. Right now, I don't want to get into the complexities of having another controller between the serial post and the bus.

The two pins to be used for communication on the PIC will be RB6 and RB7. These lines can give an interrupt on change in input. This may come in handy. Besides, bringing these lines out from the card to the host will allow in-system programming.

Communication Protocol

The communication between the host and the controllers will be by sending packets. The characters in the packets will, for now, be restricted to printable characters. This will make my job of debugging a controllers using a terminal emulator a lot easier.

All communication is initiated by the host. Thus, this is a single master configuration. The host sends a packet to a specific controller. The controller sends an acknowledgment or a response. The command from the host consists of a start of packet character, a controller address followed by one or more commands. The acknowledgment from the controller will be a start of packet character, its address and the acknowledgement character. The response from the controller will be a start of packet character, its address and one or more data characters. An end of packet may be necessary here if the number of characters in the response cannot be determined by the host.

Each controller will listen for a start of packet character and then for the address. If the command is for some other controller, it will go back to looking for a start of packet. If the packet is for that controller, it will continue to receive the command and respond with an ack or some data. The address for each controller is pre-programmed into the EEPROM.

Each controller will have a set of commands it will respond to. The commands may be specific to a type of controller. Each controller will respond to a poll command. This allows the host to check if a controller is alive and well.


Home Back Previous Next
Updated on 2 Nov 95. Feedback to