Jump to content

Little help with setting up an OLED


Altitude
 Share

Recommended Posts

Now it loads, with some special character bugs

 

According to the datasheet of your OLED, the ROMA character set will print out an ö instead of |

It seems that ROMC is better suitable.

 

The C code shows how to change it:

    Write_Command(0x72);  //Function Selection B. Select the character no. of character generator    Select character ROM
    Write_Data(0x01);  //CGRAOM 248 COGRAM 8   Select  ROM A

I guess that you've to Write_Data(0x09) instead (see http://www.buy-display.com/download/ic/US2066.pdf, page 29)

 

 

and reboot every 30 seconds

 

A reboot indicates that the USER_LCD_WaitUnbusy takes too much time.

In other words: sometimes extremely much time (> 100 mS) - not desired anyhow.

 

This could be caused by a protocol incompatibility with your display.

 

On the other hand: it seems that this LCD is so fast, that maybe the BUSY flag doesn't need to be polled at all! :smile:

 

Could you please check what happens if USER_LCD_WaitUnbusy just returns immediately without polling the status flags?

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Thanks for reply, Thorsten.

 

Yesterday I found that i missed CAN interface diode. Soldered it and cyclic reboots are gone. Nex time I should better read paragraph [3] of your MBSID troubleshooting doc  :blush: .

 

"|" character started started look normal when i'm change

movlw	0x01        	; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	rcall   USER_LCD_Data

with this.

 

	movlw	0x01 			; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	movwf	USER_LCD_LAT_D
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr

Looks like USER_LCD_Data function not working correctly with this OLED.

Sending 0x09 instead to select ROMC makes no sense. Characters still ok.

 

T.K., the question is how should look the 4-bit equivalent of this?

	movlw	0x01 			; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	movwf	USER_LCD_LAT_D
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
        swapf USER_LCD_LAT_D, F
	movlw	50			; 50 ms delay
	call	MIOS_Delay
        rcall USER_LCD_Strobe_Set
        rcall USER_LCD_Strobe_Clr
        movlw 50   ; 50 ms delay
        call MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr

 

 

 

 

 

 

 

post-9659-0-74262600-1383022894_thumb.jp

 

 

 

 

 

 

Link to comment
Share on other sites

Thanks for reply, Thorsten.

 

Yesterday I found that i missed CAN interface diode. Soldered it and cyclic reboots are gone. Nex time I should better read paragraph [3] of your MBSID troubleshooting doc  :blush: .

 

"|" character started started look normal when i'm change

movlw	0x01        	; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	rcall   USER_LCD_Data

with this.

 

	movlw	0x01 			; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	movwf	USER_LCD_LAT_D
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr

Looks like USER_LCD_Data function not working correctly with this OLED.

Sending 0x09 instead to select ROMC makes no sense. Characters still ok.

 

T.K., the question is how should look the 4-bit equivalent of this?

	movlw	0x01 			; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	movwf	USER_LCD_LAT_D
	rcall	USER_LCD_Strobe_Set     ;
	rcall	USER_LCD_Strobe_Clr     ; transfer upper 4 bit
        swapf   USER_LCD_LAT_D, F       ;
	movlw	50			; 50 ms delay
	call	MIOS_Delay
        rcall   USER_LCD_Strobe_Set     ;
        rcall   USER_LCD_Strobe_Clr     ; transfer lower 4 bit  
        movlw   50                      ; 50 ms delay
        call    MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr

Is that correct or I have to duplicate USER_LCD_LAT_D, F two times more?

 

I have some suspicions about 4-bit init fail.

 

 

 

 

 

 

post-9659-0-74262600-1383022894_thumb.jp

app_lcd.inc

Edited by Schrabikus
Link to comment
Share on other sites

Is that correct or I have to duplicate USER_LCD_LAT_D, F two times more?

 

Actually you would have to remove one strobe, because currently you transfer 3 nibbles instead of 2

And you transfer three times a 0 (-> would result into 0x000), because in 4bit mode only the data at the D7, D6, D4 and D4 pin will be taken over by the LCD.

The 4 bit protocol is: first strobe for the MSBs (data bits 7..4 directly visible at D[7:4]), second strobe for the LSBs (data bits 3..0 copied to D[7:4], e.g. via "swapf LATD, F")

You can see the difference in the original implementation: http://svnmios.midibox.org/filedetails.php?repname=svn.mios&path=%2Ftrunk%2Fmios%2Fmios_clcd.inc

 

General hint: if you do such experiments (with the danger that the LCD comes into an invalid mode), it makes sense to re-power the core after the code upload to ensure that it starts under "known conditions" (power-on reset).

 

 

Looks like USER_LCD_Data function not working correctly with this OLED.

 

In 4bit or 8bit mode?

Possible reason: USER_LCD_Data is only made for 8bit mode

 

Anyhow, currently I'm a bit confused about your posting. :-/

 

- are you planning to use the LCD in 4bit mode in future - and if yes: why? You've already all connections for 8bit mode

- is the LCD working correctly in 8bit mode now?

 

Best Regards, Thorsten.

Link to comment
Share on other sites

OLED is working fine! A little noisy, but 

I think you're right, if it's working - no need change anything.

4-bit is good for hardware compatibility, but not so critical. I'm just wanna deal with it to adapt this display to another projects with no possibility of 8-bit connection.

Thanks again!

Link to comment
Share on other sites

wrt OLED noise: What worked REALLY well for me is to use a separate 5V supply just for the OLED (Wave 1 Rolf suggested this).  I just soldered in a 78L05 in the first two pins and added a 0805 100n between them and another 10uF on the other end and it dropped the noise by at least two-thirds.  I dont know how well it would work tapping behind a linear vReg (this was on a Shruthi build, the LT1054 has very good noise rejection) but i'll be using that set up when I give the 20x4 OLED another go for my MB6582 since I use a switching 5V vreg there anyway

Edited by Altitude
Link to comment
Share on other sites

If 4bit mode is still for interest: you need a different USER_LCD_Data and USER_LCD_Cmd routine, because the one from the src/app_lcd.inc of the MBSID V2 application is only applicable for 8bit mode.

 

USER_LCD_Data should look like:

USER_LCD_Data
    ;; store byte in data latch
    movwf   USER_LCD_LAT_D

    ;; wait until display unbusy
    rcall   USER_LCD_WaitUnbusy

    ;; exit if current LCD not available due to timeout
    btfsc   USER_LCD_STATUS, USER_LCD_STATUS_CUR_DISABLED, BANKED
    return

    ;; select data register
    bsf     USER_LCD_LAT_RS, USER_LCD_PIN_RS

    ;; activate write
    bcf     USER_LCD_LAT_RW, USER_LCD_PIN_RW

    ;; strobe
    rcall   USER_LCD_Strobe_Set
    rcall   USER_LCD_Strobe_Clr

    ;; transfer lower 4 bit
    swapf   USER_LCD_LAT_D, F

    ;; strobe and exit
    rcall   USER_LCD_Strobe_Set
    rgoto   USER_LCD_Strobe_Clr

and USER_LCD_Cmd:

USER_LCD_Cmd
    ;; store byte in data latch
    movwf   USER_LCD_LAT_D

    ;; wait until display unbusy
    rcall   USER_LCD_WaitUnbusy

    ;; exit if current LCD not available due to timeout
    btfsc   USER_LCD_STATUS, USER_LCD_STATUS_CUR_DISABLED, BANKED
    return

    ;; select command register
    bcf     USER_LCD_LAT_RS, USER_LCD_PIN_RS

    ;; activate write
    bcf     USER_LCD_LAT_RW, USER_LCD_PIN_RW

    ;; strobe
    rcall   USER_LCD_Strobe_Set
    rcall   USER_LCD_Strobe_Clr
   
    ;; transfer lower 4 bit
    swapf   USER_LCD_LAT_D, F

    ;; strobe and exit
    rcall   USER_LCD_Strobe_Set
    rgoto   USER_LCD_Strobe_Clr

this is untested code!

 

Please also replace the (wrong):

	movlw	0x01 			; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
	movwf	USER_LCD_LAT_D
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
	movlw	50			; 50 ms delay
	call	MIOS_Delay
	rcall	USER_LCD_Strobe_Set
	rcall	USER_LCD_Strobe_Clr
by:
	movlw	0x01 			; /////////////////////CGRAOM 248 COGRAM 8   Select  ROM A
        rcall    USER_LCD_Data
and doublecheck later, if 0x09 is maybe the better value

 

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 3 weeks later...

This actually came up with the PreenFM2 which also uses 4bit mode and the display didnt work out of the gate but Xavier figured it out. Maybe someone who knows what they are doing may find what he said useful:

 

http://ixox.fr/forum/index.php?topic=63350.msg63931#new

Edited by Altitude
Link to comment
Share on other sites

  • 3 months later...

:D

 

I saw that Newhaven had revised their datasheets for the 4x20 OLEDs so that the actual jumper section looks like it does on the display. That might be a great way to get one working in 8-bit or 4-bit mode as you see fit...

 

With some luck things will be more calm round here so that I could investigate a bit.

Link to comment
Share on other sites

  • 2 years later...
  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...