Tom, Notes on using the built-in UART: Check and initialize the several registers associated with the UART: TXSTA RCSTA SPBRG PIR1 PIE1 TRISC (TX & RX pins both input) Follow the suggested initialization order on the data sheet (p.107 and p.109 on the 17c74 datasheet) Do NOT use the baud rate tables in the data sheets, Use the calculations instead: Fosc/(64(spbrg+1)) BRGH = 0 Fosc/(16(spbrg+1)) BRGH = 1 (for instance the table for BRGH=1 at 4MHz async says 57.6kbps at spbrg=25, which is incorrect. 9600 is correct for spbrg=25 @ 4MHz. It /looks/ like the BRGH=1 tables are the only ones incorrect, but you should double-check) Make certian TRIS for RX and TX pins are BOTH input (counterintuitive, but necessary) I've included a portion of my terminal program below (in C) which gives you a starting point. You can see the entire program in both C and ASM here: http://www.ubasics.com/adam/electronics/ha/ The following functions are not included for brevity (but are in the code on my site): initlcd() - Initialize the LCD (4-bit, two line) write8(char) - Send a character to the LCD delayms(x) - Delay about x milliseconds char initmsg(x) - Returns character x of a 16 character string. The variable RS is directly mapped to the register select pin of the LCD, and ESCCHAR is a constant set to 0x27 at the top of the c file. All other registers are named in the data sheets. Any character sent to the chip is sent to the LCD, except the esc character. The character sent after ESC is sent to the LCD instruction register. Send two esc characters to send the esc character to teh LCD data register. I hope this helps! -Adam void main(void) { uns8 x; uns8 Instruction; PORTA = 0b.0000.0000; /* All ports low at start */ PORTB = 0b.0000.0000; PORTC = 0b.0000.0000; TRISA = 0b.1100.0000; /* 7:6 Input(1), 5:0 Output(0) */ TRISB = 0b.1111.1111; /* 7:0 Input, no output */ TRISC = 0b.1100.0000; /* 7:0 Output */ // NOTE: PORTC:6 & 7 must be set INPUTS // for the UART to work correctly. SPBRG=25; // At 4MHz clock, BRGH=1, SPBRG=25 so baudrate is 9615.38 // 0.16% error (awsome) // At 4MHz clock, BRGH=0, SPBRG=6 baudrate is 8928.57 // 7% error (don't use for production) // Luckily, neither the 16C66 or the 16F8xx have BRGH // problems. I have successfully tested both of these at // 9600 (computer) with no errors. (ie, I recieved the // intended characters. You can see I'm not checking for // framing or overrun errors) TXSTA=0x24; // Async, TX enabled, BRGH=1, 8-bit RCSTA=0x90; // Receive & UART enable, 8-bit // The interrupts are disabled by default, // so I'm not messing with them. initlcd(); /* Initialize LCD */ RS = 1; /* Select the Data register on the LCD */ for(x=0;x < 16;x++) write8(initmsg(x)); // Send the init msg to the LCD for(x=0;x<16;x++) { TXREG = initmsg(x); // Send the init msg over RS-232 while(!TXIF); // Wait for the TX buffer to become empty } TXREG = '4'; while(!TXIF); TXREG = '2'; // Don't Panic! while(!TXIF); RS=0; // Write to the instruction register of the LCD write8(0x01); // Clear the LCD delayms(2); // Pause for 2 ms (only needed for fast uCs (4MHz and up), // the write8 routine is slow enough and the LCD // fast enough that pauses are generally not needed.) RS=1; // Set the next write to the data register while(1) { uns8 key, lastkey; PORTC = 0xff; if(RCIF) // Is there data in the receive register? { uns8 regbuf; // This will hold the received characters regbuf = RCREG; // Put it in a buffer if(regbuf == ESCCHAR) // Is it the escape character? (0x27) { if(Instruction == 1) // Was the last character an escape? { write8(regbuf); // Write the ESC to the LCD Instruction = 0;// Set the ESC flag low } else Instruction = 1; // This is the first ESC } else // This character is not an escape character { if(Instruction == 1) // Was the last char. an ESC? { RS=0; // Write to the instruction register write8(regbuf); RS=1; // Set it back to data register Instruction = 0;// Reset the instruction flag } else write8(regbuf); // Nothing special, write char to LCD } TXREG=regbuf; // Echo character back to sender } } } Thomas McGahee wrote: > > Dear PICSTERS, > I am in the middle of a project using a PIC16C74 and I > am having trouble getting my routines that use the > built-in Asynchronous Receiver/Transmitter to work. > Fr. Tom McGahee