Quote Originally Posted by Joe S. View Post
Oops, sorry... the question was about all this here below

Here are the configurations settings:
DEFINE RESET_ORG 1000h ' Room for Microchip USB Bootloader
define ADC_BITS 10 ' 10 bit A/D
define ADC_CLOCK 3 ' 3=rc
define ADC_SAMPLEUS 50 ' sampling time in us
define I2C_HOLD 1 ' Can't read or write MCP23016 without i2c_hold = 1

'**************** Define LCD registers and bits *********************
DEFINE LCD_DREG PORTD ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4 if 4-bit bus)
DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTC ' Set LCD Enable port
DEFINE LCD_EBIT 1 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us, 2000 us
DEFINE LCD_DATAUS 50 ' Set data delay time in us, 50 us

sda var PORTB.0 ' i2c data pin 33
scl var PORTB.1 ' i2c clock pin 34

deviceIO con $40 ' MCP23016
GP0 con $00 ' port GP0 all in
GP1 con $01 ' port GP1 all in
OLAT0 con $02 ' Output latch register 0
OLAT1 con $03 ' 1
IPOL0 con $04 ' input polarity normal, not inverted
IPOL1 con $05 '
IODIR0 con $06 ' all out = 0
IODIR1 con $07 '
INTCAP1 con $09
INTCAPbyte var byte
IOCON1 con $0b '

cmd con $fe ' LCD command
clr con 1 ' LCD clear display
blink con $0f ' LCD blinkinking cursor on
home1 con $80 ' LCD move cursor to beginning of first line
home2 con $c0 ' LCD move cursor to beginning of second line
home3 con $94 ' debug lines
home4 con $d4 ' debug lines