+ Post New Thread
Results 1 to 13 of 13
  1. #1
    Junior Member level 2
    Points: 278, Level: 3

    Join Date
    Jul 2016
    Posts
    24
    Helped
    0 / 0
    Points
    278
    Level
    3

    20x4 OLED 4 bit initilization

    Hi all,
    i need assembly or C language coding for 4bit-20x4 OLED display and initialization comparison of OLED and LCD display.

    Thanks...

  2. #2
    Advanced Member level 4
    Points: 5,122, Level: 16

    Join Date
    Jun 2016
    Posts
    1,108
    Helped
    118 / 118
    Points
    5,122
    Level
    16

    Re: 20x4 OLED 4 bit initilization

    Post the datasheet of your OLED Display which shows the initialization scheme.


    1 members found this post helpful.

    •   Alt13th April 2017, 12:02

      advertising

        
       

  3. #3
    Advanced Member level 1
    Points: 5,304, Level: 17

    Join Date
    Aug 2008
    Location
    Islamabad, Pakistan
    Posts
    436
    Helped
    73 / 73
    Points
    5,304
    Level
    17

    Re: 20x4 OLED 4 bit initilization

    If your OLED has the same controller as in LCD, then initialization will be the same.
    Otherwise read its datasheet as Okada suggested.


    1 members found this post helpful.

  4. #4
    Junior Member level 2
    Points: 278, Level: 3

    Join Date
    Jul 2016
    Posts
    24
    Helped
    0 / 0
    Points
    278
    Level
    3

    Re: 20x4 OLED 4 bit initilization

    NHD-0420DZW-AY5.pdfi have attached the datasheet
    Quote Originally Posted by Okada View Post
    Post the datasheet of your OLED Display which shows the initialization scheme.



  5. #5
    Super Moderator
    Points: 41,798, Level: 49
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    8,549
    Helped
    2061 / 2061
    Points
    41,798
    Level
    49

    Re: 20x4 OLED 4 bit initilization

    Hi,

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

    Klaus


    1 members found this post helpful.

    •   Alt13th April 2017, 12:53

      advertising

        
       

  6. #6
    Advanced Member level 4
    Points: 5,122, Level: 16

    Join Date
    Jun 2016
    Posts
    1,108
    Helped
    118 / 118
    Points
    5,122
    Level
    16

    Re: 20x4 OLED 4 bit initilization

    Here I have provided a code earlier.

    http://www.edaboard.com/showthread.p...light=NewHaven


    1 members found this post helpful.

    •   Alt13th April 2017, 13:07

      advertising

        
       

  7. #7
    Junior Member level 2
    Points: 278, Level: 3

    Join Date
    Jul 2016
    Posts
    24
    Helped
    0 / 0
    Points
    278
    Level
    3

    Re: 20x4 OLED 4 bit initilization

    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 KlausST; 21st April 2017 at 06:52. Reason: added code tags



  8. #8
    Super Moderator
    Points: 41,798, Level: 49
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    8,549
    Helped
    2061 / 2061
    Points
    41,798
    Level
    49

    Re: 20x4 OLED 4 bit initilization

    Hi,

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

    Klaus



  9. #9
    Junior Member level 2
    Points: 278, Level: 3

    Join Date
    Jul 2016
    Posts
    24
    Helped
    0 / 0
    Points
    278
    Level
    3

    Re: 20x4 OLED 4 bit initilization

    Quote Originally Posted by KlausST View Post
    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.



  10. #10
    Super Moderator
    Points: 41,798, Level: 49
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    8,549
    Helped
    2061 / 2061
    Points
    41,798
    Level
    49

    Re: 20x4 OLED 4 bit initilization

    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.



  11. #11
    Junior Member level 2
    Points: 278, Level: 3

    Join Date
    Jul 2016
    Posts
    24
    Helped
    0 / 0
    Points
    278
    Level
    3

    Re: 20x4 OLED 4 bit initilization

    Quote Originally Posted by KlausST View Post
    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?



    •   Alt21st April 2017, 09:45

      advertising

        
       

  12. #12
    Advanced Member level 4
    Points: 5,122, Level: 16

    Join Date
    Jun 2016
    Posts
    1,108
    Helped
    118 / 118
    Points
    5,122
    Level
    16

    Re: 20x4 OLED 4 bit initilization

    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.


    1 members found this post helpful.

  13. #13
    Junior Member level 2
    Points: 278, Level: 3

    Join Date
    Jul 2016
    Posts
    24
    Helped
    0 / 0
    Points
    278
    Level
    3

    Re: 20x4 OLED 4 bit initilization

    Quote Originally Posted by Okada View Post
    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?



--[[ ]]--