SneaKSz
Member
I'm having a hard time with initialising my ST7066U .It doesn't even light up.
I've checked al the connections , Vss and Vdd are also connected.
So i first use the function set ,then the cursor / display shift and finally turn the display on and clear it. But nothing happens , very strange :s.
Datasheet LCD : https://www.electro-tech-online.com/custompdfs/2010/08/40247.pdf
Could someone please look at the code and hopefully tell me what I do wrong?
Maybe the initialisation progress?
Thanks
I've checked al the connections , Vss and Vdd are also connected.
Code:
;******************************************************************************
;
;******************************************************************************
; *
; Filename: LCD *
; Date: 15/08/10 *
; File Version: *
; *
; Author: CJ *
; Company: *
; *
;******************************************************************************
; *
; Files required: P18F14K50.INC //1330.INC *
; *
;******************************************************************************
LIST P=18F14K50, F=INHX32 ;directive to define processor and file format
#include <P18F14K50.INC> ;processor specific variable definitions
;******************************************************************************
CONFIG CPUDIV = NOCLKDIV;
CONFIG USBDIV = OFF ;
CONFIG FOSC = HS;
CONFIG PLLEN = OFF;
CONFIG FCMEN = OFF;
CONFIG IESO = OFF;
CONFIG PWRTEN = ON;
CONFIG BOREN = ON;
CONFIG BORV = 30;
CONFIG WDTEN = OFF;
CONFIG WDTPS = 1;
CONFIG MCLRE = ON;
CONFIG HFOFST = ON;
CONFIG STVREN = ON;
CONFIG LVP = OFF;
CONFIG BBSIZ = OFF;
CONFIG XINST = OFF;
CONFIG CP0 = ON;
CONFIG CPB = ON;
CONFIG CPD = ON;
CONFIG WRT1= ON;
CONFIG WRTB = ON;
CONFIG WRTC = ON;
CONFIG WRTD = ON;
CONFIG EBTRB = ON;
;------------------------------------------------------------------------------
; MAIN PROGRAM
;------------------------------------------------------------------------------
;1 2 3 4 5 6 7 10 11 14 15 16
;VSS VDD VO RS R/W E DB0-DB3 DB4 -DB7 NC NC
; RB7 GND RB6 RC0-RC3 RC4-RC7
cblock 0x20
r1 ; delay
r2
r3
delay2 ; amount of delay
endc
; R/W\ ==> GND write always
#define EN PORTB,6
#define RS PORTB,7
#define DB0 PORTC,0
#define DB1 PORTC,1
#define DB2 PORTC,2
#define DB3 PORTC,3
#define DB4 PORTC,4
#define DB5 PORTC,5
#define DB6 PORTC,6
#define DB7 PORTC,7
ORG 0x00
call init
start call initlcd
init clrf TRISC
clrf PORTC
bcf ADCON0,ADON ; disable ana input
MOVLW 0F0h
movwf TRISB
clrf PORTB
clrf r1
clrf r2
clrf r3
clrf delay2
clrf WPUB ; disable weak pull-up
return
initlcd ; wait 15ms to start the LCD
movlw 0x96 ;( 150 dec) 150*100µs=15ms
movwf delay2
call delay
bcf RS ; RS low
bcf EN ; EN low
;=================Set Function==================
; DL = interface 8 bits , NL = 2 , F = 5*11
MOVLW 38h
movwf PORTC
call enwait ; 1,5 ms wachten
; wait 15ms to start the next instruction
movlw 0x96 ;( 150 dec) 150*100µs=15ms
movwf delay2
call delay
;==========================shift=======================
; 14h cursor move, shift right
movlw 14h
movwf PORTC
call enwait
;===========Display On/Off control======================
;MOVLW 0Fh ;display ON, cursor ON, cursor flash
; MOVLW 0Ch ; display ON, cursor OFF, cursor flash
movlw 0x0f
movwf PORTC
call enwait
;Clear display
; bcf RS ; RS low
; bcf RW ; R/W low
; MOVLW 0x96 ; Clear commando
; movwf PORTC
; call enwait
; return home
MOVLW 0x02
movf PORTC
call enwait
call figure
return
figure bsf RS
MOVLW 40h
movwf PORTC
call enwait
goto figure
return
enwait
bsf EN ; EN high
movlw 0x0f ; wait 1,5 ms
movwf delay2
call delay
bcf EN ; EN low
return
delay movlw 0x0A ; delay2*10²*3*333ns=100µs*delay= delay2*100µs
movwf r1
D3 movlw 0x0A
movwf r2
D4 movff delay2,r3
D5 decfsz r3,f ; 333ns
goto D5 ; 666ns
decfsz r2,f
goto D4
decfsz r1,f
goto D3
return
;******************************************************************************
;End of program
END
So i first use the function set ,then the cursor / display shift and finally turn the display on and clear it. But nothing happens , very strange :s.
Datasheet LCD : https://www.electro-tech-online.com/custompdfs/2010/08/40247.pdf
Could someone please look at the code and hopefully tell me what I do wrong?
Maybe the initialisation progress?
Thanks
Last edited: