/* PIC16F84 * .-----------. * -|RA2 RA1|- TRANSMIT (MAX232 PIN 11) * -|RA3 RA0|- * -|RA4 OSC1|- XT CLOCK pin1, 27pF to GND * PUSH BUTTON -|MCLR OSC2|- XT CLOCK pin2, 27pF to GND * GND -|Vss Vdd|- +5v * RECEIVE (MAX232 PIN 12) -|RB0 RB7|- * -|RB1 RB6|- * -|RB2 RB5|- * -|RB3 RB4|- * '-----------' * * PUSH BUTTON = PIN - BUTTON - GND * PIN - 10k - +5v */ /* MAX232 * .-----------------. * cap1+ -|1 C1+ Vcc 16|- +5v * GND -- cap3+ -|2 Vs+ GND 15|- GND * cap1- -|3 C1- T1out 14|- SERIAL COARD white * cap2+ -|4 C2+ R1in 13|- SERIAL COARD orange * cap2- -|5 C2- R1out 12|- PIC RB0 * GND -- cap4- -|6 Vs- T1in 11|- PIC RA1 * -|7 T2out T2in 10|- * -|8 R2in R2out 9|- * '-----------------' * * Note the need for four 10uF capacitors. * Capacitors 1 and 2 go from pin to pin, * and capacitors 3 and 4 go from pin to GND (watch the polarities). */ /* looking head on at the female connector of a serial mouse coard: * i.e. the end that plugs into your pc * * 5 4 3 2 1 = blue null orange white null * 9 8 7 6 = null null yellow null * * the following are loose wires on the other end of the coard. * i.e. where it would have been soldered to the mouse circuit board. * * 5 = blue = gnd = GND * 3 = orange = td = MAX232 PIN13 R1IN * 2 = white = rd = MAX232 PIN14 T1OUT * 7 = yellow = rts = unused */ #include #include "rs232.c" __CONFIG(WDTDIS & XT & UNPROTECT); main(void) { TRISA = 0b00000000; TRISB = 0b00000001; PORTA = 0; PORTB = 0; rs232_initialize(); rs232_send_string("Hello: "); for (;;) { rs232_echo_char(); } }