Altitude

Little help with setting up an OLED

48 posts in this topic

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.

Share this post


Link to post
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

 

 

 

 

 

 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

Hmm. This sounds like a good time to take another look at going after an OLED. So for a more standard OLED, all that needs to done is to solder the SMD pads and use the custom LCD driver?

Share this post


Link to post
Share on other sites

I've made connection diagram if anyone wants to use this cheap and slim module.

It's quite noisy. Electrolytic cap (in my case 220uf) soldered to power rails at LED side significantly reduced the noise.

 

ER-OLEDM2002-MBSID_Connection.pdf

post-9659-0-64495800-1383109234_thumb.pn

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I should try this method, thanks!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks a lot!

Fried last spare OLED with 12v  :pinch:  , so i'll test this code when new one arrives.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

That's fantastic news!

 

I hit a snag related to having to support the OLED both in the bootloader, and in the app itself last I checked. Hmm. hopefully there's some time for this during the x-mas break...

Share this post


Link to post
Share on other sites

Any luck on getting a 4bit driver working for the 20x4 New Haven OLED Display? I'd love to be able to put mine into my newly built MB6582.

Share this post


Link to post
Share on other sites

I think that Scifo and Schrab were in luck with their builds. It would be nice to get a blow-by-blow write up on how to get an OLED rolling. I got frustrated and left the OLED alone to pursue some other DIY projects for the longest.

Share this post


Link to post
Share on other sites

Jo, I have luck with 8 bit mode and decided to leave it working as is. Another one is still not ordered.

I'm in hibernation mode :D

Share this post


Link to post
Share on other sites

: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.

Share this post


Link to post
Share on other sites

Has anybody got a 4x20 OLED working in their mb6582 with a step-by-step? 

I was directed to this thread but seems there is no final conclusion?

Share this post


Link to post
Share on other sites

i was never able to get it to work

Share this post


Link to post
Share on other sites
On 22.7.2016 at 8:55 PM, Altitude said:

i was never able to get it to work

You need a hacking +10 stat in your character sheet to enable OLEDs or VFDs for the MB6582 ;-)

Share this post


Link to post
Share on other sites

Yeah, there is only so much time I can throw at this.  I'm about to give away the rest of my VFDs, I have no use for them

Share this post


Link to post
Share on other sites

Ah damn.. i should have checked the forum before buying a Newhaven Oled.. sad part is that i even paid a lot of import duties and shipping for it :(

Nobody got it working yet ? :(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now