Ooops, guess I missed copying some code-
LIST p=16F877
#include "p16f877.inc"
errorlevel 1, -302 ;Suppress bank 0 messages
; Memory Declarations
cblock 0x20 ; Start of general purpose memory
endc
ORG 0x000
Start:
goto Init ; Execute code
ORG 0x004
Interrupt:
goto Init ; Ignore interrupts
Init:
BANKSEL TRISA
movlw b'11111111'
movwf TRISA
BANKSEL TRISB
movlw b'11111111' ; All inputs including user buttons
movwf TRISB
BANKSEL TRISC
movlw b'11110000' ; LED lines as outputs
movwf TRISC
BANKSEL TRISD
movlw b'00000000' ; LCD lines all are outputs
movwf TRISD
BANKSEL OPTION_REG
movlw b'00000111' ; 0=PortB weak<7>,(Intedg<6>),(T0CS<5>),(T0SE<4>),(PSA<3>)256<210>
movwf OPTION_REG
;;;; Initialize UART
BANKSEL SPBRG
; Set up baud rate (9600)
movlw .129
movwf SPBRG
; Set up serial port
movlw 0x24
movwf TXSTA
BANKSEL RCSTA
; Enable port
movlw 0x90
movwf RCSTA
BANKSEL PORTA ; Normal bank again