All pastes #394983 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-14 18:31 UTC
rendered paste body
#include <p18cxxx.h>
#include <usart.h>
#include <timers.h>
#include <pwm.h>
#include <delays.h>

#pragma config LVP=OFF
#pragma config WDT=OFF

unsigned char r;
int command;


void main()
{
	TRISB = 0;
	
	// check 65 and wait 10mS after opening the uart
	OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 65);
	Delay100TCYx(0x0f);
	RCONbits.IPEN = 1;
	IPR1bits.RCIP = 1;
	INTCONbits.GIEH = 1;

	OpenTimer2(TIMER_INT_OFF & T2_PS_1_16);
	
	PORTB=0;

	while(1)
	{

		while(BusyUSART());
		while (!DataRdyUSART());

		r = getcUSART();
		PORTB=r;

		
	}
}