Basic Remote Control

All that is required to convert the previous program to a basic (send only) remote control is the addition of switch closure detection and debounce routines.  This is done in  seatalk3.asm.

It was decided to use only 4 push-buttons (+1, +10, -1, -10) as in the envisaged application other functions such as Auto and Standby should really be made from the cockpit.  These can conveniently be hooked up to Port B bits 4-7 which also have internal pull-ups, so no additional components besides the push-buttons are required.
 
A circuit diagram is provided here.
 
 

Software Design


The switch detect and debounce software is pretty basic.  The software checks for changes in the status of the port by comparing its present value with that previously read.  A delay is added by counting 256 "ticks" of the 4800 baud timer (approximately 40ms).  The four bits are then checked one by one and the appropriate code sent to the transmit routine.

The routine has some shortcomings.  If two switches are pressed simultaneously, the last (in scan order) is recognised.  If a second switch is pressed while another is held down, then its code may or may not be sent depending on whether it is scanned before or after the first switch. Thus, the convenient "tack" command on the autopilot is not available in this version of the remote control.
 

Results and Comments

It worked on the breadboard with a second identically-programmed PIC wired up to the seatalk bus and connected to the PC. Now to box it up and try it in anger!