Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] 20x4 OLED 4 bit initilization

Status
Not open for further replies.

STSCBE

Member level 2
Joined
Jul 9, 2016
Messages
43
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
360
Hi all,
i need assembly or C language coding for 4bit-20x4 OLED display and initialization comparison of OLED and LCD display.

Thanks...
 

Post the datasheet of your OLED Display which shows the initialization scheme.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
If your OLED has the same controller as in LCD, then initialization will be the same.
Otherwise read its datasheet as Okada suggested.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
Hi,

page#19 shows what to do.
Where do you see the problem?

Klaus
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
Here i added my code for OLED initilization...
but my OLED is not ON

Code:
;===============================================================================================
; 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
 
Last edited by a moderator:

Hi,

What are your exact display to microcontroller port connections?
What fixed connections?

Klaus
 

Hi,

What are your exact display to microcontroller port connections?
What fixed connections?

Klaus

D4 - PORTC0
D5 - PORTC1
D6 - PORTC2
D7 - PORTC3
EN - PORTC4
RS - PORTC5

and 16x2 lcd is perfectly working for this configuration.
 

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.
 

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.

i have written big program with 16x2 lcd display, so i want to change OLED instead of LCD. my queries are, what im going to change in OLED initialization?
 

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.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
If you use my code then nothing to change. Newhaven OLED displays are HD44780 compatible. Only Strobe duration has to be increased.

Thanks, i got..
but after update values to OLED, if i press RESET button OLED does not start from initialization. its over write to next row.... what to do?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top