Little help with setting up an OLED

So Newhaven has a line of 4X20 OLEDs out and I thought it would make for a nice upgrade for my MB6582 but looking at the data sheet, the connections look a little different from what I am used to, can anyone shed some light on how this should be connected?

http://www.newhavendisplay.com/specs/NHD-0420DZW-AY5.pdf

This pinning/connection schema is the same as usual, but omit pins 3, 15 and 16. However, the 6582 apparently runs the display in 4-bit mode so you can also omit pins 7-10 if you run the display with 4-bit mode code.

Hawkeye posted a 4-bit VFD driver that can be hacked into getting the Newhaven to behave. I got sidetracked on this during the server move and holidays, but I intend to post my code as soon as work begins anew and I can get back to this topic.

/J

Thats the direction I am going but I cant get it running in 8 or 4 bit mode on a standard core

I know the troubles, had a Newhaven clone (Electronic Assembly) for some time (until it burned on me for no reason) - it stayed nicely black after wiring - then after a few hours of hacking, I managed to get nice (oled ftw) but still garbage output, it looked like it was expecting 8-bit input, but the MB6582 is wired only for 4-bit mode, init failure so to say…

http://discourse.midibox.org/t/topic/15481

As another alternative, after a talk with Wilba, he told me, that it is possible to alter the MB6582 to use 8 display data lines - in that case, I´d expect the “garbage” display driver to work - ask Wilba for moar info. Why and how that works, is out of my understanding though (aren´t those 4 lines used anywhere else on the MB6582?).

Wilba, did you manage to get your OLED up and running (the Electronic Assembly one)?

Greets,

Peter

so how does one go about using a custom LCD driver?

Hope I didn´t miss anything:

a) checkout - use subversion to checkout the latest mios8 sources

b) toolchain - manage to compile your own midibox sid -> and test upload mb6582.hex to your first core.

c) replace app_lcd.inc in mb6582 directory with your new version (e.g. the downloaded one from my thread)

d) adjust main.inc to use custom display type 7, i think.

e) adjust makefile to include app_lcd .inc

f) test with garbage instructions in new app_lcd.inc, if it is compiled (compiler should be annoyed)

g) adjust initialization code in app_lcd.inc

h) compile new version

i) upload to first core

1 Like

Ok, I am back on this.

I tried Hawkeye’s VFD driver and unless I am doing something wrong when making the hex, it does not seem to work (black screen)

I simply replaced the app_lcd.inc file in the SRC folder and built the app. I did verify it was reading the file like suggested above by just putting garbage in the file. Any steps I missed here? I could not find where to set the custom LCD in the main.inc. I did not include that file in the makefile either. If anyone would like to point out any errors in my ways here, please feel free since I am clueless on how to perform steps d-g above.

After some searching, I did find this site which addresses the initialization commands for my specific display: http://www.elcojacobs.com/controlling-an-oled-character-display-with-arduino/ its for arduino, but I figured someone who understands the commands might find it useful.

Hiya!

Hawkeye’s VFD driver does some 4bit magic. I tweaked it to use a more Newhaven-centric display init in the main SID app, but I missed out on the fact that there’s display init also done in the bootloader!

I assume you use the Newhaven 4x20 OLED .

Currently I’m tied up with my modular, but it would be fun to get this display business done. Maybe the Newhaven requires less tweaking if we re-jig it to use 8 bits instead. I remember looking the display PCB and the PDF and shaking my head, at the time I trouble correlating the actual board with what is described in the manual… Better look again.

/J

Well, let me put a bounty on it then: I have an extra green 4x20 to anyone who helps get this up an running. They are great displays and reasonably priced

I need to refresh my memory, but here’s from my app_led.inc from when I was on it. Not sure if it’s the latest, we need to cross-check this against the data sheet again:

USER_LCD_Init

	;; notify that no graphical LCD is connected

	bcf	MIOS_BOX_CFG0, MIOS_BOX_CFG0_USE_GLCD


	; (Initialization of Ports: done in Init_Ports)

	SET_BSR	USER_LCD_STATUS

	clrf	USER_LCD_STATUS, BANKED


	movlw	100 ; 100 ms delay

	call	MIOS_Delay


        bcf USER_LCD_LAT_RW, USER_LCD_PIN_RW	; LCD_WRITE

        bcf USER_LCD_LAT_RS, USER_LCD_PIN_RS	; USER_LCD_PIN_RS_0


	;; initialize LCD

	movlw	0x3

	movwf	USER_LCD_LAT_D

	rcall	USER_LCD_Strobe_Set

        movlw	10 ; 10 ms delay

	call	MIOS_Delay

	rcall	USER_LCD_Strobe_Clr

        movlw	10 ; 10 ms delay

	call	MIOS_Delay


	movlw	0x3

	movwf	USER_LCD_LAT_D

	rcall	USER_LCD_Strobe_Set

        movlw	10 ; 10 ms delay

	call	MIOS_Delay

	rcall	USER_LCD_Strobe_Clr

        movlw	10 ; 10 ms delay

	call	MIOS_Delay


	movlw	0x3

	movwf	USER_LCD_LAT_D

	rcall	USER_LCD_Strobe_Set

        movlw	10 ; 10 ms delay

	call	MIOS_Delay

	rcall	USER_LCD_Strobe_Clr

        movlw	10 ; 10 ms delay

	call	MIOS_Delay


	movlw	0x2

	movwf	USER_LCD_LAT_D

	rcall	USER_LCD_Strobe_Set

        movlw	10 ; 10 ms delay

	call	MIOS_Delay

	rcall	USER_LCD_Strobe_Clr

        movlw	10 ; 10 ms delay

	call	MIOS_Delay


        movlw	50 ; 50 ms delay

	call	MIOS_Delay


	movlw	0x2B ; Function set		

	rcall	USER_LCD_Cmd

	movlw	0x08 ; Display Off		

	rcall	USER_LCD_Cmd

	movlw	0x01 ; Display Clear

	rcall USER_LCD_Cmd

	movlw	0x06 ; Entry Mode Set to Auto Increment

	rcall USER_LCD_Cmd

	movlw	0x02 ; Home Command

	rcall USER_LCD_Cmd

	movlw	0x0C ; Display ON

	rcall USER_LCD_Cmd


	movlw	0x00 ; set cursor to zero pos

	rgoto	USER_LCD_CursorSet

one thing I noticed looking at the guy who ran in on the arduino was that all his delays we much longer than your values, maybe thats the issue?

I like the run in 8 bit mode idea though.. The MB6582 board is provisioned for it but I’ll need to dig through the documentation and see if I can figure it out since I dont know anyone who’s done it

Ahh. Think I got my delays from the datasheet, but that don’t mean that they suffice

I wonder if it’s not easier to grok how to modify the OLED board jumpers to make it run in a more sane 8-bits? If we’re lucky we don’t have to mess around with the init that much if it’s similar enough to a HD44780…

Where are the jumpers? Am I missing something that obvious? It should be perfectly compatible with the HD44780, I use the 16x2 ones in the shruthis i build and they work perfectly without any modification, its just a drop in for the LED backlit ones

Had a nice talk with Wilba about that last year - you can reconfigure/bridge the MB6582 baseboard to allow 8-bit display connectivity - then (he said) the OLED might work right out of the box - how it is done, he must explain to you (would be nice to document it somewhere :).

Many greets!

Peter

I’m not building the custom driver in right. nILS is putting the smack down on me right now so I should be able to proper test your driver tonight.

Oh, cool!

I’m not 100% sure this was my latest or greatest, I found it in a working directory in my lab PC at work. It looked familiar enough, but it’s possible I went ahead and changed more stuff in my compile/source dir. I’ll take a gander at this vs the data sheet later tonight.

nope, I did it right :frowning: just doesnt work.

I’ll play around some more with this tonight. nILS does not seem keen on the 8bit mode though..

Sheesh!

The code I posted is deffo something unfinished: I looked at pp21 in the Newhaven datasheet:

For 4bit display init, I think that all the funky business with

movlw 0x3

        movwf USER_LCD_LAT_D

        rcall USER_LCD_Strobe_Set

        movlw 10 ; 10 ms delay

        call MIOS_Delay

        rcall USER_LCD_Strobe_Clr

        movlw 10 ; 10 ms delay

        call MIOS_Delay

plus the 50ms wait need to go away. The datasheet starts with Power on. Wait more than 1ms for power stablization. I dunno why all those other delays are there in the code, need to check with Hawkeye. Then we should send function set where:

[Function Set:

RS R/W DB7 DB6 DB5 DB4

0 0 0 0 1 0

0 0 0 0 1 0

0 0 1 0 X X

And then do some waiting for the busy flag.

Then on to display off. Busy flag wait.

Display clear. Wait for busy flag.

Entry mode set. Wait for busy flag.

Home command. Wait for busy flag.

Display on.

Let there be light!

tell me what to code into the app_lcd.inc and i’ll give it a try when i get home

I’ll try to e-mail you the entire thing when I’m back at work tomorrow. Basically all the init business is below the wait 50ms code in the above example. I’m not sure about all the waiting around before that though.

We should double-check the values I set, and make sure that Hawkeye’s

USER_LCD_Cmd does it’s thing correctly (i.e send 2x4bits plus wait for the busy flag).

/J