Hardware
The testboard K3 is set up with
reset circuit, crystal oscillator at 4 MHz and a MAX232 for RS232 communication. The 4 arrows in the circuit diagram indicate signal direction.
Testboard K3 configured for 873uart.asm
Software in C
//************************************************************************
// Processor: PIC16F873
at 4 MHz
// Function: Characters
received via RS232 (19200 baud 8-N-1) are returned
// Hardware: Testboard
K3
// Language: C
// Compiler: CCS PCM
// Filename: 873_ser.c
// Author: Lars Petersen, oz1bxm@pobox.com
//*************************************************************************
#include <16F873.h>
#fuses NOPROTECT, XT,
NOWDT, PUT, NOLVP, BROWNOUT
#use delay(clock=4000000)
#use rs232(baud=19200,
xmit=PIN_C6, rcv=PIN_C7 ) // Use the micro's UART
main() {
setup_adc(ADC_OFF);
// all pins portA digital I/O
while (TRUE)
{
putc(getc()); // echo the received char
}
}
Remarks
The MAX232 is used for RS232 communication.
A simpler circuit can be set up using DS275, see the homepage of Wichit
Sirichote from Thailand.