Hi Tony, The code below is very simular to what you sent me, I have made only slight modifications or additions. Here is what I am trying to do: If a 'A' is received I want to make RB0 Hi If a 'B' is received I want to make RB1 Hi If any other character is received, do nothing I will add additional cases for additional letters once I get this simple code to work. The problem: If I send a 'A' RB0 goes Hi If I send a 'B' nothing happens If I send any other characters, nothing happens. When I change the no_b sub to the following, I get weird results: no_b movlw 00h ; Set RB0 & RB1 Lo if other characters are received movwf PORTB goto MnLoop The problem: If I send a 'A' RB0 goes Hi then Lo (Quick Flash) If I send a 'B' nothing happens If I send any other characters, nothing happens. Best Regards, Tim Title "RS232 Test" ; list p=16f877,c=140 ; processor type errorlevel 1, -(305) #include "p16f877.inc" ; ; Configuration Bits: ; ; Oscillator = HS ; Watchdog Timer = Off ; Power Up Timer = On ; Code Protect = Off ; Brown Out Detect = On ; Low Voltage Program = Disabled ; Data EE Protect = Off ; Flash Program Write = Enabled ; Background Debug = Disabled ; ; DESCRIPTION: ; ; Baud Rate = 9600, No Parity, 8 bits & 1 Stop Bit, Hardware = None ; ; RS232 | MAX233 MAX233 | 16F877 ; -------------- --------------- ; 2-RX | 5-TX 2-TX | 25-TX ; 3-TX | 4-RX 3-RX | 26-RX ; ; DelayL equ 0x20 ; delay register LOW byte DelayM equ 0x21 ; delay register MID byte DelayH equ 0x22 ; delay register HIGH byte RxHold equ 0x23 ; Save Rx data in this register Start bcf STATUS, RP0 clrf PORTA clrf PORTB movlw b'01000000' ; TX = Hi movwf PORTC clrf PORTD clrf PORTE bsf STATUS, RP0 clrf TRISA clrf TRISB movlw b'10000000' ; RX = In movwf TRISC clrf TRISD movlw b'11111000' movwf TRISE movlw b'00000111' movwf ADCON1 ; PORTA inputs = digital movlw d'129' ; 9600 baud @ 20 Mhz Fosc +0.16 err movwf SPBRG movlw b'00100100' ; BRGH = 1 movwf TXSTA ; enable Async Tx bcf STATUS, RP0 movlw b'10010000' ; enable Async Rx movwf RCSTA call Delay500 ; startup stabilize delay call blink ; show sign of life MnLoop call Receive movlw 'A' subwf RxHold btfss STATUS, Z goto no_a movlw 01h ; Set RB0 Hi if 'A' Received movwf PORTB movwf TXREG call TransWt goto MnLoop no_a movlw 'B' subwf RxHold btfss STATUS, Z goto no_b movlw 02h ; Set RB1 Hi if 'B' Received movwf PORTB goto MnLoop no_b goto MnLoop TransWt bsf STATUS, RP0 WtHere btfss TXSTA, TRMT ; transmission is complete if hi goto WtHere bcf STATUS, RP0 return Receive nop btfss PIR1, RCIF ; check for received data goto Receive movf RCREG, W movwf RxHold return blink movlw 01h ; RB0 Hi movwf PORTB call Delay500 movlw 00h ; RB0 Lo movwf PORTB call Delay500 movlw 01h ; RB0 Hi movwf PORTB call Delay500 movlw 00h ; RB0 Lo movwf PORTB return Delay500 clrf DelayL ; Clear DelayL Register clrf DelayM ; Clear DelayM Register movlw 06h ; Move literal 06h to W register movwf DelayH ; Move w register to DelayH register Wait1 decfsz DelayL ; Decrement 1 from DelayL Register, skip if zero goto Wait1 ; Not 0, continue loop decfsz DelayM ; Decrement 1 from DelayM Register, skip if zero goto Wait1 ; Not 0, continue loop decfsz DelayH ; Decrement 1 from DelayH Register, skip if zero goto Wait1 ; Not 0, continue loop return end -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads