This should probably be moved to the 'Examples' section, but I'll post it here for awhile so it will get noticed.

This routine takes keyboard input, including backspaces, and processes them through a command parser. It converts all chars (but not numbers) to uppercase before processing.

Enjoy.

Code:
 '****************************************************************
;
;Name    : Code Example                                      
'*  Author  : Charles Linquist                                  
'*  Date    : 9/10/2011                                         
'*  Version :1.0                                               
'*  Notes  :  For the Forum                                                
'****************************************************************
 
        DEFINE OSC 40                                                           
 
        DEFINE NO_CLRWDT 1
        DEFINE _18F8723 1
        DEFINE HSER_RCSTA 90H
        DEFINE HSER_TXSTA 20H
        DEFINE HSER_BAUD 9600
        DEFINE HSER_CLROERR 1
        DEFINE LOADER_USED 1                                               
 
 
        TRISC = %10111111 
 
        MaxChars var byte
        Inputstring var byte [12]
        Timeout var word
        X var byte
        CharInput var byte
        InputString_Len Var Byte
        CMD VAR BYTE
 
 
        MaxChars = 10
        InputString_Len = MaxChars
        Timeout = 9000
 
        BS con 8
        CR CON 13
        LF CON 10
        ESC CON 27
        SP CON 32
 
 
topp:
 
 
    Gosub GetCharInput
     Gosub ConvertToUpper
    Gosub Parseit
 
    goto topp
 
 
;-------------------------------------------------------------------
GetCharInput:
 
HSEROUT [CR,LF,"Input ? "]
 
 
TextIn:
        ArrayWrite InputString,[REP 0\MaxChars] ; zero out the string to start with
        X = 0 
 
TextIn2:
        HSERIN Timeout,NoInput,[CharInput]
        IF CharInput = CR Then Goto DoneInput
        If CharInput = ESC THEN goto NoInput
           IF CharInput = BS THEN 
               IF X = 0 THEN
                Goto TextIn2 
           ELSE   
                HSEROUT [BS,SP,BS]
               X = X - 1
              InputString[x] = 0 ; zero out the backspaced char
              GOTO TextIn2
          ENDIF 
     ENDIF    
 
InputString[X] = CharInput
        HSEROUT [CharInput]      ; Show what we got                                                    
 
        IF X >= MaxChars then goto DoneInput
        X = X + 1
        GOTO TextIn2
DoneInput:
        Return
 
 
NoInput:
        ArrayWrite InputString,[REP 0\MaxChars]  ; wipe everything 
out
        hserout [CR,LF,"No Input!",CR,LF]
 
Return
 
 
;------------------------------------------------------------------------------
 
 
ConvertToUpper:
     For X = 0 to MaxChars
       IF InputString[X] > 96 and INputString[X] < 123 then
          InputString [X] = Inputstring[X] & %11011111
       ENDIF     
 
     Next X
 
     Return
 
 
;-----------------------------------------------------------------------------
 
 
Parseit:
 
Parse01: Cmd=01 : ARRAYREAD InputString,InputString_Len,Parse02,[WAIT("AGE")] : GOTO Foundit
Parse02: Cmd=02 : ARRAYREAD InputString,InputString_Len,Parse03,[WAIT("BIRTHDAY")] : GOTO Foundit
Parse03: Cmd=03 : ARRAYREAD InputString,InputString_Len,Parse04,[WAIT("CITY")] : GOTO Foundit
Parse04: Cmd=04 : ARRAYREAD InputString,InputString_Len,Parse05,[WAIT("STATE")] : GOTO Foundit
Parse05: Cmd=05 : ARRAYREAD InputString,InputString_Len,Parse06,[WAIT("COUNTRY")] : GOTO Foundit
Parse06: 
Cmd=255
 
 
 
Foundit:
 
 
  Select Case Cmd
      Case 1
        Hserout [CR,LF,"You typed 'AGE'",CR,Lf]
      CASE 2
        Hserout [CR,LF,"You typed 'BIRTHDAY'",CR,Lf]
      CASE 3
        HSEROUT [CR,LF,"You typed 'CITY'",CR,Lf]
      CASE 4
        HSEROUT [CR,LF,"You typed 'STATE'",CR,Lf]
      CASE 5
        HSEROUT [CR,LF,"You typed 'COUNTRY'",CR,Lf]
      CASE ELSE
        HSEROUT [CR,LF,"Invalid command",CR,LF]
   END SELECT
 
 
RETURN