#CONFIG
__CONFIG _CONFIG1, _FCMEN_OFF & _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _CP_ON & _IESO_OFF & _BOREN_OFF & _PWRTE_OFF
__CONFIG _CONFIG2, _PLLEN_OFF & _STVREN_OFF & _LVP_OFF
#ENDCONFIG
OSCCON = %01101010 'sets the internal oscillator to 4Mhz
TRISA = %00000000
TRISC = %00000000
ANSELA = %00000000
ANSELC = %00000000
OPTION_REG.7 = 0
WPUA = %00000000
WPUC = %00000011
PORTA = 0
PORTC = 0
SCL VAR PORTC.0
SDA var PORTC.1
RESET var PORTC.2 ; IT'S REQUIRED?
cbyte var byte 'CONTROL BYTE FOR DATA
I2C var byte 'CONTROL BYTE FOR CONTROL CODES
cbyte = 0 'USE TO send a command
I2C = $7C 'ADDRESS FROM MANUAL ??
main:
I2CWRITE SDA,SCL,I2C,cbyte,[$25] 'contrast
PAUSE 1
I2CWRITE SDA,SCL,I2C,cbyte,["HELLO"] 'print on the first line
pause 3000
goto main
end
Bookmarks