Hello Anthony, Here is a simple source code listing which configures the USART module of the PIC16C65 for 1200 Baud, 8 data bits and no Parity. The program is complete and will assemble directly using MPASM. The program first configures the USART and LCD module for 4-bit mode, and then waits for reception of a character via the RS232 RX line, (RC7/RX). After receiving a character, the program then transmits the same character back to the host via the TX line, (RC6/TX) whilst displaying the character on the LCD module for test purposes. I think you will find that this program is just what you are looking for since a couple of weeks back I was in exactly the same situation, having only snippets of code from many different sources. If you have any queries at all then please don't hesitate to ask, but e-mail me directly please. Lee Hewitt (Manchester ENGLAND) e-mail: LHewitt104@aol.com TITLE "UART & LCD Without Interupts 1200 Baud operation" SUBTITLE "Version 1.3" LIST P=16c65, R=HEX include "p16c65.inc" include "a:\defs\lcd_defs.h" __config _CP_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC ;Handshaking Equates SOH equ 0x01 STX equ 0x02 ETX equ 0x03 EOT equ 0x04 ENQ equ 0x05 ACK equ 0x06 ;Defines #define ZERO STATUS,Z #define CARRY STATUS,C #define RPAGE STATUS,5 #define E_LINE PORTB,4 #define RS_LINE PORTB,5 #define RBPU 0X01,7 ;Macro definitions ddr_setup macro bsf STATUS,RP0 ;Select page 1 for TRIS set-up movlw b'00000000' movwf TRISA movlw b'00000000' movwf TRISB bsf RBPU bcf STATUS,RP0 ;Select page 0 after TRIS set-up endm pulse_e macro bsf E_LINE call short_delay bcf E_LINE endm ;variables cblock 0x20 RX_BYTE TX_BYTE dly_cnt_1 dly_cnt_2 dly_cnt_3 temp temp1 endc ;----------------------------------------------------------------------------- ; reset vector ;----------------------------------------------------------------------------- org 0 goto reset ;----------------------------------------------------------------------------- ; program entry point ;----------------------------------------------------------------------------- reset movlw b'00010000' ;Added from LCD code movwf PORTA movlw b'00001111' movwf PORTB ddr_setup ;Call macro to configure DDR's call init_lcd ;Initialise LCD module call long_delay ;Wait for LCD to reliably initialise call long_delay ;Wait for LCD to reliably initialise bcf STATUS,RP1 ;Always maintain this bit clear (origional reset ) bcf STATUS,RP0 ;Select bank 0 clrf INTCON ;Disable all interupts movlw b'10000000' ;Disable weak pull-ups on Port B option ;Initial set-up of I/O ports movlw 0x00 ;movwf PORTA ;movwf PORTB movwf PORTC movwf PORTD movwf PORTE ;Set-up of DDR's bsf STATUS,RP0 ;Select bank 1 movlw 0x00 movwf TRISD ;Port D - all pins unused, output 0 movwf TRISE ;Port E - all pins unused, output 0 movlw b'10000000' movwf TRISC ;Pin 7, RX=i/p; pin 6, TX=o/p clrf PIE1 ;Disable all peripheral interupts clrf PIE2 ;Dissable all CCP interupts bcf STATUS,RP0 ;Select bank 0 ;Initialise USART movlw b'10010000' ;Load RCSTA with 0x90 movwf RCSTA bsf STATUS,RP0 ;Select bank 1 movlw .46 ;46 for 1200 Baud movwf SPBRG ;Baud rate is now set at 1200 bps movlw b'10100000' ;Load TXSTA with 0xA0 movwf TXSTA bcf STATUS,RP0 ;Select bank 0 ;serial RX/TX routines clrf TXREG poll_rx btfss PIR1,RCIF ;Wait to receive a byte from host goto poll_rx movf RCREG,w ;Load received data into w reg movwf RX_BYTE ;Store received data in file reg REC_BYTE poll_tx btfss PIR1,TXIF ;TXIF is set when TXREG is empty or clear goto poll_tx movlw 0x06 ;Load data for transmission directly ! movwf TXREG ;Transmit the data when TXREG is loaded ;LCD driver block movf RX_BYTE,w ;Load w reg with received byte for display call send_lcd_char goto poll_rx ;loop back to start of main program ; ********* subroutines ********* init_lcd movlw MODE_8 ;MUST BE INCLUDED call send_lcd_cmd ;MUST BE INCLUDED movlw 0x32 ;MUST BE INCLUDED call send_lcd_cmd ;MUST BE INCLUDED movlw MODE_4 ;function mode set-up call send_lcd_cmd ;4-bit mode, 2 lines, 5x7 dot format movlw INC_NSFT ;entry mode set-up* call send_lcd_cmd ;cursor incriment on write* movlw DISP_ON_FLASH call send_lcd_cmd movlw CLR_DISP call send_lcd_cmd ;clear diaply, cursor home call long_delay return send_lcd_cmd movwf temp swapf temp,w andlw 0X0F bcf RS_LINE bcf E_LINE movwf PORTB call short_delay pulse_e ;call macro call short_delay movf temp,w andlw 0F movwf PORTB call short_delay pulse_e ;call macro call short_delay return send_lcd_char movwf temp swapf temp,w andlw 0X0F bsf RS_LINE bcf E_LINE iorlw 0X20 movwf PORTB call short_delay pulse_e ;call macro call short_delay movf temp,w andlw 0F iorlw 0X20 movwf PORTB call short_delay pulse_e ;call macro call short_delay return ;Delay routines short_delay movlw 0X08 movwf dly_cnt_1 dly_loop_1 decfsz dly_cnt_1,f goto dly_loop_1 return med_delay movlw 0X80 movwf dly_cnt_2 dly_loop_2 call short_delay decfsz dly_cnt_2,f goto dly_loop_2 return long_delay movlw 0X40 movwf dly_cnt_3 dly_loop_3 call med_delay decfsz dly_cnt_3,f goto dly_loop_3 return end --------------------- LCD Header file: TITLE "Header File: "lcd_defs.h" nolist ;TEMP equ 0x035 ;temporary register ;CHAR equ 0x036 ;temporary register, Holds value to send to LCD module. ; ; Control Commands For The Hitachi LM032L LCD Module ;FUNC_... - Function Set and Display Resolution, ( 4 bit, 2 lines, 5 x 7 dots) MODE_8 equ 0x033 MODE_4 equ 0x028 ; CURS_RHT equ 0x093 DD_RAM_ADDR equ 0x080 ;Least Significant 7-bit are for address DD_RAM_UL equ 0x080 ;Upper Left coner of the Display ; ; ; CLR_DISP equ 0x001 ;CLEAR display and HOME cursor command HOME_DISP equ 0x002 ;HOME cursor command - (restores shifted display ) NW_LINE equ 0x0C0 ;NEW LINE command ;ENTRY_... - Sets Entry Mode, S = Display Shift ON, INC / DEC Cursor Move Dir DEC_NSFT equ 0x004 ; DEC_SFT equ 0x005 ; INC_NSFT equ 0x006 ; INC_SFT equ 0x007 ; ;DISP_... - Display ON / OFF Control, CSR = Cursor ON, FLASH = Flash char pos DISP_OFF equ 0x008 ;Display OFF DISP_ON equ 0x00C ;Display ON DISP_ON_CSR_ON equ 0x00E ;Display ON, Cursor ON DISP_ON_FLASH equ 0x00F ;Display ON, Cursor ON, FLASH cursor ;SFT_... - Cursor & Display Shift, DISP = Display, CSR = Cursor, LFT = Left, RHT = Right SFT_CSR_LFT equ 0x010 SFT_CSR_RHT equ 0x014 SFT_DISP_LFT equ 0x018 SFT_DISP_RHT equ 0x01C list