Below is the file 'firm/master/serial.c' from this revision. You can also download the file.

// ### BOILERPLATE ###
// 8^2 Automaton Firmware
// Copyright (C) 2005 Peter Todd <pete@petertodd.org>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// ### BOILERPLATE ###

void open_serial()
{

	// Configure UART serial transmit
        // Configured for:
	//  9600 Baud
	//  8N1

	// SPBRG - Baud Rate Generator Register
	SPBRG = 129; // 20MHz => 9600 baud (BRGH = 1)

	// BRGH - High Baud Rate Select Bit
	TXSTAbits.BRGH = 1; // (0 = low speed)

	// SYNC - USART Mode select Bit
	TXSTAbits.SYNC = 0; // (0 = asynchronous)

	// TRISC - Tri-state Data Direction Register for port C
	// RC6 - 6th pin of port C - used for Serial Transmit
	// RC7 - 7th pin of port C - used for Serial Receive
	TRISCbits.TRISC6 = 0; // (0 = pin set as output)
	TRISCbits.TRISC7 = 1; // (1 = pin set as input)

	// SPEN - Serial Port Enable Bit
	RCSTAbits.SPEN = 1; // (1 = serial port enabled)

	// TXIE - USART Transmit Interupt Enable Bit
	PIE1bits.TXIE = 0; // (1 = enabled)

	// RCIE - USART Receive Interupt Enable Bit
	PIE1bits.RCIE = 0; // (1 = enabled)

	// TX9 - 9-bit Transmit Enable Bit
	TXSTAbits.TX9 = 0; // (0 = 8-bit transmit)

	// RX9 - 9-bit Receive Enable Bit
	RCSTAbits.RX9 = 0; // (0 = 8-bit reception)

	// CREN - Continuous Receive Enable Bit
	RCSTAbits.CREN = 0; // (1 = Enables receiver)

	// TXEN - Trasmit Enable Bit
	TXSTAbits.TXEN = 1; // (1 = transmit enabled)

	// GIE - Global Interrupt Enable Bit
	INTCONbits.GIE = 0; // (1 = Enable all unmasked interrupts)

	// PEIE - Peripheral Interrupt Enable Bit
	INTCONbits.PEIE = 0; // (1 = Enable all unmasked peripheral interrupts)
}

void rs232_sendbuf(const char const *b,uint8_t m){
static	uint8_t i;
	i = 0;
	while ((b[i] != 0) && (i < m)){
		// Wait for TXREG to be ready
		while(!PIR1bits.TXIF);

		// Place char in TXREG - this starts transmition
		TXREG = b[i];

		i++;
	}
}