In my case, i'll prefer to use only one PORT for the LCD.  something like PORTB<5:0>. That way, it will leave you all the analog pins on PORTA you can need for you application.
i hate to have one device on multiple ports if i don't need any specific function to this port like PWM or CCP.
you can change the default LCD setting using DEFINE.  Look PBP manual in the LCDOUT section.
at the end, it will look like that
	Code:
	    ' Lcd defines
    ' ===========
    '
    define LCD_DREG PORTB     ' Set data pin of LCD to
    define LCD_DBIT 0         ' PORTB.0-PORTB.3
    define LCD_RSREG PORTB    ' Set RS bit of LCD to
    define LCD_RSBIT 4        ' PORTB.4
    define LCD_EREG PORTB     ' Set E bit of LCD to
    define LCD_EBIT 5         ' PORTB.5
 by using alias to ouputs/input, it make life easier to access to them
	Code:
	TRISC = 255 ' set input to all pin of PORTA
TRISB=0 ' set output to all pin of PORTB 
OptoCoupler var PORTB.6
PushButton var PORTA.1
ADCON1=7 ' disable A/D converter
start:
     If PushButton then ' is pushbutton is pressed
          OptoCoupler = 1 ' activate opto coupler
     endif
 
				
			
Bookmarks