Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Post the datasheet of your OLED Display which shows the initialization scheme.
;===============================================================================================
; Subroutine Name : init_lcd
; Purpose : Initialise LCD for 4 Bit Communication
; Input : Nil
; Output : Nil
;===============================================================================================
init_lcd:
;function set:
;
ldi temp, 15
rcall com_wt ; wait for 15ms after power on reset
ldi temp, 0b00000011 ;
rcall lcd_out
;function set:
ldi temp ,5
rcall com_wt
ldi temp, 0b00000011
rcall lcd_out
;function set
rcall delay_micros
rcall delay_micros
ldi temp,0b00000011
rcall lcd_out
ldi temp,5
rcall com_wt
;function set for 4 bit mode 2lines and 5x7 font size
ldi temp,0b00000010
rcall lcd_out
rcall delay_micros
ldi temp,0x28;0b00001100
rcall com_out;lcd_out
ldi temp,2
rcall com_wt
;cursor/display shift: shift the cursor position to right
ldi temp , 0b00010100
rcall com_out
rcall delay_micros
;display on/off mode
ldi temp , 0b00001100
rcall com_out
rcall delay_micros
;entry mode
ldi temp , 0b00000110
rcall com_out
rcall delay_micros
;clr display
ldi temp , 0b00000001
rcall com_out
ldi temp , 2
rcall com_wt
ret
;===============================================================================================
; Subroutine Name : com_out
; Purpose : To send command word to LCD by 4 bit communication
; Input : temp (Register)
; Output : Nil
; Registers Used : temp, temp1
;===============================================================================================
com_out:
push temp
swap temp
andi temp,0b00001111
ori temp,0b00000000
rcall lcd_out
pop temp
andi temp,0b00001111
ori temp,0b00000000
rcall lcd_out
rcall delay_micros
ret
;===============================================================================================
; Subroutine Name : lcd_out
; Purpose : To send 1 Byte data to LCD by 4 bit commmunication
; Input : temp (Register)
; Output : Nil
; Registers Used : temp, temp1
;===============================================================================================
lcd_out:
in temp1,portc
andi temp1,0b11000000
or temp,temp1
out portc,temp
sbi portc,lcd_en
nop
cbi portc,lcd_en
ret
Hi,
What are your exact display to microcontroller port connections?
What fixed connections?
Klaus
Hi,
with the given code you just init the display and clear the display.
There is no data output.
So how can you know it is OFF?
Klaus
PS: Please give all informations at once, to keep the discussion short. No piece by piece informations.
what im going to change in OLED initialization?
If you use my code then nothing to change. Newhaven OLED displays are HD44780 compatible. Only Strobe duration has to be increased.