I'm working on a PIC project that just wont do what it is supposed to do when all the various functions are assembled in to one file, so having a couple of pins spare, I decided time to look at various registers on an LCD and see what was going on (original project doesn't have a display attached).
I found some I2C LCD code on here originally written by Mike - K8LH back in August 2018 for the 16F690 and as I am using the 16F1827, I have modified Mike's code to suit the 16F1827 and attached the file here.
Just make sure to assign the pins you want to use for SCL & SDA in the appropriate place - I'm using RA1 & RA4 as I had those spare.
Rich (BB code):
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; define 'scl' and 'sda' port and pins
;
iic_tris equ TRISA ; TRIS reg for scl/sda pins
iic_port equ PORTA ; PORT reg for scl/sda pins
sclndx equ RA1 ; index for scl pin (RA1)
sdandx equ RA4 ; index for sda pin (RA4)