Searching \ for '[EE] DOGM LCD' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/lcds.htm?key=lcd
Search entire site for: 'DOGM LCD'.

Exact match. Not showing close matches.
PICList Thread
'[EE] DOGM LCD'
2011\04\04@013202 by IVP

face picon face
Hi all,

I mentioned these LCDs a while back and got a 16x2 from Mouser

http://www.lcd-module.com/products/dog.html

Had great hopes for it in a particular project

Do you think I can get a flicker of life out of it ? Every other LCD
I've worked with has at least some indication of power applied,
such as blocks or 8888, but not this one/type. Completely blank

Been looking around for initialisation code and found several people
with the same problem and replies that seem to be all over the place
wrt to the ST7036 datasheet, yet these replies say that their code
works

I've spent quite a bit of the weekend with the wretched thing and
tried so many permutations of "working code" I thought I would
have gotten a result by sheer accident

But no

Does anyone here have actual working tested verifiable assembler
code to get "Hello World" on a DOGM 16x2 ?

TIA

Jo

2011\04\04@075049 by cdb

flavicon
face
Joe,

:: Does anyone here have actual working tested verifiable assembler
:: code to get "Hello World" on a DOGM 16x2 ?

Are the code examples (although for 8051 type architectures) of no help on their download page?

Colin
--
cdb, spam_OUTcolinTakeThisOuTspambtech-online.co.uk on 4/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 

2011\04\04@082955 by IVP

face picon face
> Are the code examples (although for 8051 type architectures) of no
> help on their download page?

Nope

Most perplexing

I saw comments about problems with the Busy Flag, and did notice
some oddness myself. Sometimes BF cleared, sometimes not. At the
moment the D7 line goes low but not quite to 0V. That's using 1ms
delays rather than the polling scheme EA suggest

As I said, fiddle around enough and something usually happens to
get the ball rolling, but this LCD's putting up a fight

Jo

2011\04\04@100718 by jim

flavicon
face

Isn't a LOW logic signal always some magnitude above zero volts?  Maybe
200 - 300 mv or so.
In some cases higher.  The spec for TTL, IIRC, for a logic low is <.8V,
and a high is >2.2V
or 2.4V, I can't remember for sure.  For CMOS I believe it is .2Vdd and
..8Vdd respectively.
So running a COMS device from 5V, a low would be < 1.0V and a high
would be >4.0V.
With this said, as long as the levels you're seeing as a logic low fit
these criteria, then
all should be okay.  However, if they wind up in the undefined area
between these levels, that
may be where your problem lies.  And that is that the levels are being
interpreted incorrectly,
therefore, it doesn't work.

If this is the case, maybe you have a bad ground somewhere.  Or maybe
you just happened to get  a bad display.  
Regards,

Jim

> ---{Original Message removed}

2011\04\04@102511 by IVP

face picon face
> Isn't a LOW logic signal always some magnitude above zero
> volts? Maybe 200 - 300 mv or so. In some cases higher

That's true, although other lines are not noticeably above 0V

> However, if they wind up in the undefined areabetween these
> levels, that may be where your problem lies.  And that is that
> the levels are being interpreted incorrectly, therefore, it doesn't
> work

The line which doesn't go as low as a 'normal' 44780-based LCD
is Busy, which is driven by the LCD, so there's nothing I can do
about that. However, it is low enough to be recognised as a 0 by
the PIC

> If this is the case, maybe you have a bad ground somewhere

Don't think so. There's only the PIC and the LCD

> Or maybe you just happened to get a bad display

Hope not. At the stage where I think I need to throw in the towel
and e-mail EA. I'm sure the information is there somewhere, it's
just not being presented well enough. The ST7036 controller has
a lot more going on than the 44780 (which EA bravely say is
obsolete)

Jo

2011\04\04@104105 by alan.b.pearce

face picon face
www.lcd-module.de/eng/pdf/zubehoer/st7036.pdf

Is this the data sheet? From a quick skim through it, it seems to be as comprehensive as any other LCD driver datasheet I have come across.


-- Scanned by iCritical.

2011\04\04@112423 by jim

flavicon
face

Joe,

If you would send me your code for the initialization, I'll look it
over and see if I find anything wrong.
I'm sure you've looked over it several times, but maybe a new pair of
eyes can find something.
Let me know.  If you don't want to do this, that's okay.  I just
thought I'd offer to look it over.

Regards,

Jim

> ---{Original Message removed}

2011\04\04@115318 by Olin Lathrop

face picon face
jim@jpes.com wrote:
> Isn't a LOW logic signal always some magnitude above zero volts?

No.

A low logic signal will have some upper limit it is allowed, but zero volts
is almost always within the valid range.  Many PIC inputs require a logic
low input to not exceed .2 Vdd and allow it to be something like -300mV (not
sure exactly, check datasheet).

In practise small negative voltages can occur due to ground offset, not even
considering short term transients.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

2011\04\04@191353 by IVP

face picon face
> If you would send me your code for the initialization, I'll look it
> over and see if I find anything wrong.

Jim

Below is where I left it. Initially it was the same as the example in
the ST7036 datasheet (yes, that's the one Alan). Since then it's
been hacked around - different values, delays, Reset and CSB
under/not under PIC control etc etc etc

Not a flicker, so at this stage I've no idea how close or far away
it is from working. Which is the frustrating bit. I wouldn't expect
you to, but if you Google for DOGM PIC code you won't find
two examples the same. That is generally not the case for 44780
and compatibles, which don't have features like selectable Vdd,
bias, op-amp follower gain and so on. I get the feeling that some
have got "Hello World" and are happy enough with that

I'll be e-mailing EA to get the skinny and see if they have code
examples not posted in the Download section of their site or any
"Oh, you have to do this too" advice. As we know from our
experiences with Microchip, the coupling of hardware and
documentation isn't always as good as it should be

COG displays are fragile but the LCD was very well packaged
and shows no sign of damage (unlike the one which someone on
a forum put into a breadboard and wrecked getting out, poor guy).
Mine is on a mounting PCB so it's fairly robust to work with

I'll contact EA and then have a day away from it to get on with
other things

Joe

Using it with an 18F2520 @ 40MHz. ms01 is 1ms delay, us100
is 100us, usec is 1us. No problem with a typical 16 x 2 (using
typical initialisation)

;================================================
;        Initialise LCD screen (16x2, 8-bit, 5V)
;================================================

lcd_init movlw  0x38             ;function set 1
        call   wr_c_del
        movlw  0x38             ;function set 2
        call   wr_c_del
        movlw  0x1c             ;bias
        call   wr_busy
        movlw  0x58             ;power/icon/contrast
        call   wr_busy
        movlw  0x60             ;follower
        call   wr_busy
        movlw  0x7f             ;contrast
        call   wr_busy
        movlw  0x0f             ;display on
        call   wr_busy
        movlw  0x01             ;clear
        call   wr_busy
        call   ms01
        call   ms01
        movlw  0x06             ;mode
        call   wr_busy
        return

wr_c_del call   write_c
        call   ms01
        return

wr_busy  call   ms01
        bra    wr_c_del

        movwf  temp0
        mov    b'10000000',trisb
        usec
        bcf    rs
        usec
        bsf    rw
        usec
        bsf    en
        usec
chk_busy movlw  b'10000000'
        andwf  portb,w
        skpz
        bra    chk_busy

        mov    b'00000000',trisb
        usec
        bcf    rs
        usec
        bcf    en
        usec
        bcf    rw
        usec
        movf   temp0,w
        call   write_c
        return

write_c  movwf  temp0
        bcf    rs            ;write command
        bra    d_out

write_d  movwf  temp0
        bsf    rs            ;write data

d_out    bsf    en
        call   us100
        movfw  temp0
        movwf  latb
        call   us100
        bcf    en
        call   us100
        retur

2011\04\04@193038 by Oli Glaser

flavicon
face
On 05/04/2011 00:13, IVP wrote:
> Not a flicker, so at this stage I've no idea how close or far away
> it is from working.

If the display is completely blank, you may have a dead one - perhaps you could confirm with someone what it's meant to do when you apply power (blocks, cursor or whatever)
Either way, sounds like a good idea to fire off a couple of e-mails and get on with something else in the meantime.

2011\04\04@202827 by IVP

face picon face
> If the display is completely blank, you may have a dead one

Yes, that's the problem when there are unknowns with only a single
sample. Can't make comparisons and gather evidence. If I'd seen
just one pixel appear or some sort of contrast change then maybe
I'd be just a bit happier. I was exceedingly careful with it because
COG displays are brittle but the possibility is there that it was duff
all along

Oh well. I've asked EA for advice, they can clear up that issue
anyway

Jo

2011\04\04@203658 by jim

flavicon
face
I was reading through the datasheet for the controller chip and read that
the contrast is adjusted via command and software.  Could it be that the contrast isn't adjusted to the point where it can be
seen?  
Also, what is the intended viewing orientation 12:00 or 6:00?  This might be
enough of a difference that something possibly could be seen.

Just food for thought.

Jim

{Original Message removed}

2011\04\04@205231 by IVP

face picon face
> I was reading through the datasheet for the controller chip and read
> that the contrast is adjusted via command and software.  
> Could it be that the contrast isn't adjusted to the point where it can be
> seen?  
I'd thought of that and tried the full range of values in the Cx bits. Been
caught with a no-contrast setting before ! ;-) I noticed that more than
one example sets contrast mid-way. My experience with other LCDs,
those with a contrast pot, is that they don't have much of a contrast
range and Vo needs to be close to 0V. Contrast setting at mid-Vdd
is barely visible, if at all. I generally use a fixed Vo, Vdd-4k7 + 47R-Vss

> Also, what is the intended viewing orientation 12:00 or 6:00?  This
> might be enough of a difference that something possibly could be seen

I don't recall if EA mention a viewing angle, but you'd expect to see
something looking straight on

> Just food for thought.

But am I hungry today ? 8-))

Thank

2011\04\05@085303 by IVP

face picon face
> Either way, sounds like a good idea to fire off a couple of e-mails

I got my reply from 'Ralph' at EA

Answered questions I didn't ask and didn't answer the one I did

No response about what the display does or looks like on power-up

Sent examples in AVR C that I'd already looked at and transcribed
at the weekend

Asked if I'd read the ST7036 datasheet when I said I had and told
me that 44780 code doesn't work, which I didn't even mention

Waste of &#!@#*^ time that was

Now I'll have to e-mail back and ask again

grrrrrrrrr

Jo

2011\04\05@205057 by IVP

face picon face
> fire off a couple of e-mails and get on with something else in
> the meantime

2nd reply from EA -

"there is no self test. The display doesn't show anything without the
correct initialisation"

Self-test ?

"anything" is ambiguous. It could mean blank, it could mean no
characters. I wish he'd just answer with the specifics I ask for

DOGM LCD is unfortunately now at the back of the desk until I
gets around to it. Sounds like a proper "How To" page needs to
be written if/when it's working

Sigh

Jo

2011\04\06@030000 by cdb

flavicon
face


:: No response about what the display does or looks like on power-up

I had a quick gander at the controller datasheet. If the chips aren't under a blob, are you able to see if CS1 and CS2 get set? Apparently nothing will happen if both aren't at logic one.

I've just realised Elektor has a circuit for 120RGB Leds that used this display. They've programmed it in basic for the AVR.

On the Elektor site look for 100743.zip

Just had a quick look, and for the life of me i can't see how the author initialised the display, there is;

'----------------- INITIALISATION DES PERIPHERIQUES : LCD CAN RC5 KEYPAD
Config Graphlcd = 128 * 64eadogm , Cs1 = Portd.4 , A0 = Portd.7 , Si = Portb.3 , Sclk = Portb.5 , Rst = Portd.5

Ah, BASCOM basic uses a specific library file for this particular display. I have a feeling the libraries are compiled ones. But the hex file is available if you feel like a bit of AVR disassembling!

Colin
--
cdb, .....colinKILLspamspam@spam@btech-online.co.uk on 6/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au

2011\04\06@031758 by cdb

flavicon
face
part 1 4330 bytes content-type:text/plain; charset="us-ascii" (decoded quoted-printable)



:: Sounds like a proper "How To" page needs to
:: be written if/when it's working

If your German is adequate, this blog page might help, unfortunately the only person who seems to have succeeded wants to charge for his code.

http://www.mikrocontroller.net/topic/75589

A question (initialisation not working):

Genau so sieht es bei mir auch aus.
Ich finde das ziemlich fies, dass man nicht vom Display lesen kann,
nicht mal den Status, so wei? ich nicht einmal wo das Problem liegt.
Vielleicht nur eine kleine Leitung falsch? Man wei? es leider nicht...
Aber wenn ich mir wenigstens beim Code sicher sein k?nnte, w?re das
schon mal ein Fortschritt!

Meine Initialisierung:

------------------------------------------------------------------------
Reset HIGH
200ms warten
Reset LOW
------------------------------------------------------------------------
spi_master_send_char(0x40); // Display start line 0

spi_master_send_char(0xA1); // ADC reverse

spi_master_send_char(0xC0); // Normal COM0~COM63

spi_master_send_char(0xA6); // Display normal

spi_master_send_char(0xA2); // Set bias 1/9 (Duty 1/65)

spi_master_send_char(0x2F); // Booster, Regulator and Follower on

spi_master_send_char(0xF8); // Set internal Booster to 4x
spi_master_send_char(0x00);

spi_master_send_char(0x27); // Contrast set
spi_master_send_char(0x81);
spi_master_send_char(0x16);

spi_master_send_char(0xAC); // No indicator
spi_master_send_char(0x00);

spi_master_send_char(0xAF); // Display on
------------------------------------------------------------------------

Die spi_master_send_char(unsigned char) sieht so aus:


void spi_master_send_char (unsigned char c)
{
 SPDR = c;                    // sende Zeichen
 while (!(SPSR & (1<<SPIF)))  // warten bis Senden moeglich
 {
 }
 _delay_us(100);
}

(vorher nat?rlich spi init)


The answer:

Wer tut das nicht.

Ausschnitt aus meiner Code f?r das Modul zur Initialisierung ?ber SPI
(Prinzip f?r Parallel identisch):

void lcd_contrast_intern( uint8_t contrast )
{
 /* "electronic volume" */
 lcd_spi_write( ST7565R_ELECTRONIC_VOLUME_MODE_SET );
 lcd_spi_write( ST7565R_ELECTRONIC_VOLUME_REGISTER_SET | ( contrast & 0x3F ) );
}

void lcd_init( uint8_t options )
{
 /* init according to the EA DOGM datasheet      with additions from the ST7565R datasheet */

 // Reset module (hardware)
 lcd_hw_reset( 1 );
 // Wait time power stabilize
 delay_ms( 50 );
 // Release reset
 lcd_hw_reset( 0 );
 // wait reset-circuit finished
 delay_10usec();

 lcd_cs_select();
 lcd_rs_command();

 // Display start line 0
 lcd_spi_write( ST7565R_DISPLAY_START_LINE | 0);
#ifdef EA_DOGM_TOPVIEW
 // ADC set normal
 lcd_spi_write( ST7565R_ADC_SELECT_NORMAL );
 // Common output mode normal COM63-COM0
 lcd_spi_write( ST7565R_COMMON_OUTPUT_MODE_REVESE | 0 );
#else /* bottom view */
 // ADC set reverse
 lcd_spi_write( ST7565R_ADC_SELECT_REVERSE );
 // Common output mode normal COM0-COM63
 lcd_spi_write( ST7565R_COMMON_OUTPUT_MODE_NORMAL | 0 );
#endif /* EA_DOGM_TOPVIEW */
 // Display normal
 lcd_spi_write( ST7565R_DISPLAY_NORMAL  );
 // Set bias 1/9
 lcd_spi_write( ST7565R_LCD_BIAS_SET_1_9 );

#ifdef EA_DOGM_SINGLE_SUPPLY
 // booster, regulator, follower on
 lcd_spi_write( ST7565R_POWER_CONTROL_SET |
   ST7565R_BOOSTER_MASK | ST7565R_REGULATOR_MASK |
   ST7565R_FOLLOWER_MASK );
 // internal booster to 4x
 lcd_spi_write( ST7565R_BOOSTER_RADIO_SET );
 lcd_spi_write( ST7565R_BOOSTER_STEP_UP_2x3x4x );
#else /* dual - untested */
 // booster off, regulator and follower on
 lcd_spi_write( ST7565R_POWER_CONTROL_SET |
   ST7565R_REGULATOR_MASK | ST7565R_FOLLOWER_MASK );
#endif

 // "contrast set"
 // V0 resistor-ratio (see table 11, here 6.5 -> 0b111 = 0x07)
 lcd_spi_write( ST7565R_V0_VOLTAGE_REG_INT_RES_RAT_SET | 0x07  );
   // Electronic volume
 lcd_contrast_intern( LCD_CONTRAST_DEFAULT );
   // static indicator off
 lcd_spi_write( ST7565R_STATIC_INDICATOR_OFF  );
 lcd_spi_write( ST7565R_STATIC_INDICATOR_REGISTER_OFF );
 // display on
 lcd_spi_write( ST7565R_DISPLAY_ON  );

 lcd_rs_data();
 lcd_cs_unselect();
}

Colin
--
cdb, colinspamKILLspambtech-online.co.uk on 6/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 
 


part 2 181 bytes content-type:text/plain; name="ATT00001.txt"
(decoded base64)

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2011\04\06@043350 by alan.b.pearce

face picon face
> DOGM LCD is unfortunately now at the back of the desk until I
> gets around to it. Sounds like a proper "How To" page needs to
> be written if/when it's working

Might be worth keeping track of this thread at the Microchip forums ...
http://www.microchip.com/forums/tm.aspx?m=570742&mpage=1#msgNum1

Seems to have some C source code for something that was supposed to work.


-- Scanned by iCritical.

2011\04\06@051323 by IVP

face picon face
> If the chips aren't under a blob, are you able to see if CS1 and
> CS2 get set?

Unfortunately it's COG, a wide 40-pin DIP. The IC would be under
the black strip. Quick snapshot under ceiling light, the display area is
actually grey. The lines are markings on the protective plastic. Yes,
it had me worried when I saw it in the box ! Aw, broken already ?

http://home.clear.net.nz/pages/joecolquitt/dogm_162a.jpg

Transparent, which is the attraction wrt backlighting, because you
can roll your own

http://home.clear.net.nz/pages/joecolquitt/dogm_162b.jpg

> On the Elektor site look for 100743.zip

> http://www.mikrocontroller.net/topic/75589

Cheers

Joe

2011\04\06@051323 by IVP

face picon face
> http://www.microchip.com/forums/tm.aspx?m=570742&mpage=1#msgNum1

Thanks

Jo

2011\04\06@072743 by Olin Lathrop

face picon face
cdb wrote:
> If your German is adequate, this blog page might help, ...
>
> A question (initialisation not working):
>
> Genau so sieht es bei mir auch aus.
> Ich finde das ziemlich fies, dass man nicht vom Display lesen kann,
> nicht mal den Status, so weiß ich nicht einmal wo das Problem liegt.
> Vielleicht nur eine kleine Leitung falsch? Man weiß es leider nicht...
> Aber wenn ich mir wenigstens beim Code sicher sein könnte, wäre das
> schon mal ein Fortschritt!

Not much here.  This guy is basically saying the same thing Joe is.  "It
looks the same to me too".  Then he goes on to lament that he can't tell
what the fault is because he doesn't see any response from the display at
all.  No solution is offered.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000

2011\04\06@073914 by cdb

flavicon
face


:: No solution is offered.

Ah my mistake, I only recognise written German that is similar to either Norwegian or English.

Colin
--
cdb, .....colinKILLspamspam.....btech-online.co.uk on 6/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 

2011\04\06@074939 by cdb

flavicon
face
Ah Olin,

Pressed send before I should have, the second snip of code is from Martin (the man who charges for his code) Further down the blog list (I'm not expecting you to read the whole blog) is someone thanking Martin for his initialisation code and that his display now works.

To others -

I think the poster who is thanking Martin is talking about taking A0 high after the initialisation code.
Ich weiß zwar nicht was ich jetzt wirklich anders gemacht habe, aber
mein DOGM scheint sich auf magische Weise initialisiert zu haben. :) Ich
habe jetzt, wenn ich nach dem Initialisieren A0 auf HIGH setze, ein
Standbild mit zufälligen Pixeln, wohl einfach ein zufälliger RAM-Inhalt..
Immerhin!
Martin's code is that below the Wer tut das nicht in my original post.

Colin


--
cdb, EraseMEcolinspam_OUTspamTakeThisOuTbtech-online.co.uk on 6/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 

2011\04\06@075935 by Oli Glaser

flavicon
face
Joe,
It's a shame you are having problems as these look pretty nice - I'm just choosing a couple of displays and I had a look at the link you posted. Stupid question, but where did you actually order from?
I think I might risk a few quid and try one out, the software/fonts that comes with them, plus the SPI connection, 3.3V voltage and easy 2.54mm DIP type module all seems nice and convenient.

2011\04\06@080450 by Oli Glaser

flavicon
face
On 06/04/2011 12:59, Oli Glaser wrote:
> Stupid question, but where did you actually order from?
As with most stupid questions, the answer was not far away :-)
I checked on the contact page and (amazingly) the distributors were all listed there.

2011\04\06@081746 by Olin Lathrop

face picon face
cdb wrote:
> Ich weiß zwar nicht was ich jetzt wirklich anders gemacht habe, aber
> mein DOGM scheint sich auf magische Weise initialisiert zu haben. :)
> Ich habe jetzt, wenn ich nach dem Initialisieren A0 auf HIGH setze,
> ein Standbild mit zufälligen Pixeln, wohl einfach ein zufälliger
> RAM-Inhalt. Immerhin!

"I have no idea what I did differently, but now it magically initializes.
Now when I raise A0 after initialization I can see random pixels displayed."

2011\04\06@082807 by IVP

face picon face
> I checked on the contact page and (amazingly) the distributors
> were all listed there

Got mine from Mouser. If you do get one, I recommend you mount
it on a PCB or stripboard. It's more delicate than the numeric COG
displays I usually work with

Olin's translation of the German blog has me interested again - as a
matter of principle I'd like to get it working. Made good progress
with a few jobs today so I should be able to have another crack at
it soon

Jo

2011\04\06@113039 by Gerhard Fiedler

picon face
Olin Lathrop wrote:

> cdb wrote:
>> If your German is adequate, this blog page might help, ...
>>
>> A question (initialisation not working):
>>
>> Genau so sieht es bei mir auch aus.
>> Ich finde das ziemlich fies, dass man nicht vom Display lesen kann,
>> nicht mal den Status, so weiß ich nicht einmal wo das Problem liegt.
>> Vielleicht nur eine kleine Leitung falsch? Man weiß es leider nicht...
>> Aber wenn ich mir wenigstens beim Code sicher sein könnte, wäre das
>> schon mal ein Fortschritt!
>
> Not much here.  This guy is basically saying the same thing Joe is.  "It
> looks the same to me too".  Then he goes on to lament that he can't tell
> what the fault is because he doesn't see any response from the display at
> all.  No solution is offered.

FWIW, that's the first post Colin copied. The second (after "The answer"
in Colin's post) provides an initialization sequence, implying that it
works for him (the second poster).

Gerhard

2011\04\08@081217 by IVP

face picon face
> Then he goes on to lament that he can't tell what the fault is
> because he doesn't see any response from the display at all

Using the code below, trying as best as I can to emulate the 8051
sequence in the ST7036 datasheet, I see no Busy activity

Here's an analyser grab

http://home.clear.net.nz/pages/joecolquitt/dogm_162_analyser.gif

If I'm following the initialisation faithfully, which AFAICT I am wrt
both data and timing, maybe EA can explain why this is happening

Unless anyone can see a problem with my logic

Joe

;================================================
;        Initialise LCD screen (8-bit, 5V)
;================================================

        bsf     psu             ;LCD power
        call    ms01
        bsf     rst
        call    ms100
        call    ms100           ;power-up delay

        bcf     rs
        nop
        bcf     rw
        nop
        bcf     en

        call    lcd_init

;-------------------

lcd_init bcf    rst              ;hardware reset
        call   us100            ;200us delay
        call   us100
        bsf    rst
        call   ms40             ;40ms delay

        movlw  0x38             ;function set 1
        call   wr_c_del
        movlw  0x38             ;function set 2
        call   wr_c_del
        movlw  0x14             ;bias
        call   wr_busy
        movlw  0x78             ;power/icon/contrast
        call   wr_busy
        movlw  0x5e             ;follower
        call   wr_busy
        movlw  0x6a             ;contrast
        call   wr_busy
        movlw  0x0c             ;display on
        call   wr_busy
        movlw  0x01             ;clear
        call   wr_busy
        call   ms01             ;2ms delay
        call   ms01
        movlw  0x06             ;mode
        call   wr_busy
        return

wr_c_del call   write_c
        call   us30             ;30us delay
        return

wr_busy  bsf    trisc,7          ;c,7 as input
        usec
        bcf    rs
        usec
        bsf    rw
        usec
        bsf    en
        usec

chk_busy bcf    en
        btfss  portc,7          ;wait for c,7 = 0
        bra    not_busy
        bsf    en
        bra    chk_busy

not_busy bcf    trisc,7          ;c,7 as output
        usec
        bcf    en
        usec
        bcf    rw
        usec
        call   write_d
        call   us30
        return

write_c  bcf    rs               ;write command
        bra    d_out

write_d  bsf    rs               ;write data

d_out    bsf    en
        usec
        movwf  latc
        usec
        bcf    en
        usec
        retur

2011\04\08@090644 by cdb

flavicon
face


:: ;================================================
:: ;        Initialise LCD screen (8-bit, 5V)
:: ;================================================

Isn't the DOGM version 3v3 max?

Colin
--
cdb, colinspamspam_OUTbtech-online.co.uk on 8/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 

2011\04\08@094037 by IVP

face picon face
> Isn't the DOGM version 3v3 max?

It's selectable. There's a charge pump for 3V3 supply, using
the CAP1N/CAP1P and VOUT/VIN pins

Examples of connections here

http://www.lcd-module.de/eng/pdf/doma/dog-me.pdf

I just noticed that has a different initialisation sequence from the
the one in the ST7036

Oh, for ..... goodness sake

Jo

2011\04\09@011254 by William \Chops\ Westfield

face picon face

> (initialisation not working)

I haven't been paying lots of attention.  Does this
arduino code help any:  https://github.com/halfbyte/lcddogmspi

BillW

2011\04\09@030621 by IVP

face picon face
> Does this arduino code help any:  https://github.com/halfbyte/lcddogmspi

Thanks, I'll give it go. It does look very similar to some C I found

These LCDs have been around for wee while. It's surprising that
code for them is very sparse, maybe because many people can't
get them working so they don't make it into finished projects

I need to focus on getting the Busy flag working immediately after
the two Function Set commands. Trying to complete initialisation
without the LCD joining in the fun is probably pointless

Joe

2011\04\11@185844 by IVP

face picon face
part 1 2717 bytes content-type:text/plain; charset="iso-8859-1" (decoded quoted-printable)

Hi all,

for the time being I've given up on the DOGM

I've spent another day with it and made no progress. I'm just not
seeing any activity on the Busy line. If you look at the power-up
screen shot you'll see data-07 is flat "low

---------
An internal reset circuit automatically initializes the ST7036 when
the power is turned on. The following instructions are executed
during the initialization. The busy flag (BF) is kept in the busy state
(BF = 1) until the initialization ends. The busy state lasts for 40 ms
after VDD rises to stable.
---------

I've tried everything I can think of, but I don't see anything. If Busy
isn't working, for whatever reason, then trying to set registers and
display anything is pointless

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=800364

Hints of 44780 code and yet the author says it works. I'm
seeing many variations that don't tally with ST7036 and/or
EA documentation

Which leads me to the ponderables

- are the specs particularly loose, anything works
- are the specs particularly fussy, you have to tinker
- is my LCD broken, so whatever I try won't work

Here's my latest power-up sequence variation, 18F2520

        call    ms100           ;PIC power-up delay

        bsf     trisc,7         ;Busy line as input
        bsf     psu             ;LCD power
        call    ms01
        call    ms01
        bsf     rst             ;LCD Reset
        nop
        bsf     csb             ;LCD CSB  (/CE)
        call    ms100           ;power up delay, 100ms

        bcf     rst             ;LCD hardware reset
        call    ms01            ;low for 1ms
        bsf     rst
        call    ms100           ;100ms delay

        bcf     csb             ;chip select low
        call    ms100           ;100ms delay

        bcf     rs              ;LCD control lines low
        nop
        bcf     rw
        nop
        bcf     en

        bcf     trisc,7
        call    lcd_init

Ralph Tischer of EA replies
---------
what a pitty. It also less then satisfying to me to hear such. On the
other  hand I do not have any PIC example for you (all companies
are forcing me to get but at the end nobody is willing to provide his
code for other people). And I'm not a software guy to comment
you the code; I'm sorry.

May be it's more a thing of hardware with you and not software,
who knows?
----------

The next time I place an order with Mouser I might get another,
but for now it's back to the tried-and-tested backlit 44780

If anyone does happen to get one working, I'd love to hear about
it. Oh, and a (free) look at the code would be appreciated ;-)))

Joe

part 2 5351 bytes content-type:image/gif; name="dogm_162_powerup.gif" (decode)


part 3 181 bytes content-type:text/plain; name="ATT00001.txt"
(decoded base64)

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2011\04\11@202404 by Oli Glaser

flavicon
face
Sorry to hear about your troubles Joe..
Is a pity as they look like nice displays.

In the last few days I have acquired a DisplayTech 64128N COG display, I think it is probably pretty similar - uses the ST7565 controller.
I had a few problems getting it started - no example code around, datasheet sadly lacking (didn't even say whether it was set up for serial or parallel mode, what step up ratio, etc, etc)
The ST7565 datasheet isn't too bad, but it can be set up a load of different ways and there is no info on this in the 64128N datasheet.
On the Displaytech site there was some hex code (didn't say what uC for) and some assembler which was of some use. Until I got it working it looked completely dead, absolutely nothing from it. I got to the point where I signed up for the forum - that was 3 days ago and I'm still waiting for my "approval" e-mail.. :-)
Anyway, it is now working okay, and I have got it working with the MC Graphics Library (another story there - had to set it up for a dsPIC30F I'm using and the display - the library is only specified for PIC32, 24 and dsPIC33F, with a few larger displays)
Would be happy to send you any of this stuff if you want to grab one of these, just let me know. It needs cleaning up and sorting out, but the basics work.




On 11/04/2011 23:54, IVP wrote:
{Quote hidden}

2011\04\11@204009 by IVP

face picon face
> Would be happy to send you any of this stuff if you want to grab one
> of these, just let me know. It needs cleaning up and sorting out, but
> the basics work.

Oli, thanks for the offer

Some time today I'll put the analyser on a standard 44780 16x2 as
a reference as to what happens on power-up. I've never needed to
do that as they just plain work

I'll be interested to see what Busy activity there is. If there's none,
and the data sheet says there should be, then there's a little bit of
hope for the DOGM yet

Will get back to you

Jo

2011\04\11@220932 by Oli Glaser

flavicon
face
On 12/04/2011 01:40, IVP wrote:
>> Would be happy to send you any of this stuff if you want to grab one
>> of these, just let me know. It needs cleaning up and sorting out, but
>> the basics work.
> Oli, thanks for the offer

I just looked back at the start of the thread - I actually  forgot this was a character LCD, the one I'm using is a small (128 x 64 mono - white on blue) graphics one, sorry for the confusion..
Of course you're still welcome to the code anyway..

> Some time today I'll put the analyser on a standard 44780 16x2 as
> a reference as to what happens on power-up. I've never needed to
> do that as they just plain work

Yeh, useful feature that.. :-)

> I'll be interested to see what Busy activity there is. If there's none,
> and the data sheet says there should be, then there's a little bit of
> hope for the DOGM yet
>

Good idea, I have never checked this either, but I would imagine there should be some. I'm sure in the past I have used the busy check rather than just waiting. Mind you, maybe the DOGM one does things differently - are you using it in serial mode? If so maybe the busy line is disabled and the check is done via the SPI line, or something like that.

> Will get back to you
>
> Joe

2011\04\12@024342 by IVP

face picon face
>> I'll be interested to see what Busy activity there is. If there's none,
>> and the data sheet says there should be, then there's a little bit of
>> hope for the DOGM yet
>>
>
> Good idea, I have never checked this either, but I would imagine
> there should be some

OK. When you power up a 44780 LCD, Busy goes high, no matter
what the state of the control lines. If left open, they all go high too

After much trial and error, Busy does appear on the DOGM if and
only if RS=0, RW=1, E=1 and PIC TRIS=1. It lasts for only 20ms
though, not the datasheet 40ms

http://home.clear.net.nz/pages/joecolquitt/dogm_reset.gif

I've looked at the MOS buffers on the pins. The datasheet says D7
has a weak pull-up, equating to around 76kohm. If an external p/u
or p/d is added (10k or 100k), Busy is affected, so it's probably not
an impedance (eg floating) or voltage artefact between D7 and
TRIS/LAT

With the control line states in mind, interestingly it does re-appear
for 16us during the two Function Sets, when the datasheet says it
can't be checked

http://home.clear.net.nz/pages/joecolquitt/dogm_busy.gif

I've managed to get something working of a sort by keeping every
line in the Busy-reading state unless actually writing. In that instance,
Busy goes high at every write. However, looking more closely, that
is initiated by R/W going low, not E going low. E's falling edge starts
the data write, and Busy is already high, so I'm guessing the LCD
won't accept the command. I've double-checked and the analyser
pin names are correct

http://home.clear.net.nz/pages/joecolquitt/dogm_busy_detail.gif

I'm possibly one blindfolded dart-throw blunder away from getting
it going ;-)) but I can't see how I can get around that R/W initiation
though, when I can't reconcile what I see with what's in the datasheet

Sometimes of course two wrongs can make a misleading half-right,
so I'm still using my indoor swearing voice

Jo

2011\04\12@030606 by cdb

flavicon
face
My research seems to point out that the main difficulty is configuring the
TWO control registers which differ depending on the Vcc and model. after
which 44780 code works with no problem.

I've discovered what looks like to be the most complete working code yet on
the CCS-Info forum, this even caters for the 5v and 3v3 and several
different models.


1 // define some items for 5v, SPI bit bang (emulated spi hardware)
   2 #define EADOGM163       1        // to use MODEL EADOG163
   3 #define EADOGMVDD       5        // 5v LCD Vdd
   4 #define EADOGM_SPI_SW   1        // sw bit bang, can use any io pins
   5 #define EADOGM_PIN_RS   PIN_E2   // RS line, (pin 39 on the LCD)
   6 #define EADOGM_PIN_CSB  PIN_B7   // /CSB line, (pin 38 on the LCD)
Req for SPI Opt for 8BIT
   7 #define EADOGM_SCLK_BB  PIN_E1   // Connects to pin 29 on LCD
   8 #define EADOGM_MOSI_BB  PIN_E0   // Connects to pin 28 on LCD
   9
  10 #include "ea-dogm_mio.c"
  11



And here is the complete driver source file.
ea-dogm_mio.c
   1 /*
   2  *            file: EA-DOGM_MIO.c
   3  *         version: 2.03
   4  *     description: Multi I/O driver for EA DOGM displays
   5  *                : Uses 8Bit, SPI HW or SPI SW (bitbang)
   6  *     written by : Michael Bradley (@spam@mbradleyKILLspamspammculabs.com)
   7  *   contributions: Imaginos (CCS forum), Emil Nad (8Bit testing)
   8  *                  jgschmidt (CCS forum)
   9  *
  10  *   Changelog:
  11  *       04/22/2010 v2.03 Minor update, changed EADOGM_SPI_HW for HW
SPI 1 and 2
  12  *                  Added setup_spi() for HW SPI use, and spi_clk_div
option
  13  *                  thanks to jgschmidt (ccs forum) for noticing hw
setup issues
  14  *       12/03/2009 v2.02 bug fix and printChr change, no user change
needed for use
  15  *       11/25/2009 v2.01 Minor changes, replaced some functions with
macros
  16  *       09/17/2009 v2.00 Major change, IO is now 8Bit or SPI (hw or
sw)
  17  *                  rewrote some defines as related to pins
  18  *       09/15/2009 v1.13 added function eaDogM_WriteIntAtPos()
  19  *                  and eaDogM_WriteStringAtPos()
  20  *                  added some defines to clean source
  21  *       08/28/2009 v1.12 EADOGM_COLSPAN defined internally, allowing
for
  22  *                  162 model to position correctly (noted by
Imaginos, CCS forum)
  23  *                  Added support for 2nd SPI HW port (suggested by
Imaginos, CCS forum)
  24  *                  defined a few more special chr's
  25  *       07/12/2009 v1.11 Fixed #define error surrounding BB SPI ini
  26  *                  added eaDogM_ClearRow(row);
  27  *       07/11/2009 Created/Consolidated this file from my testing
sets
  28  *
  29  * Usage:
  30  *   In your source, you need to define which EA DOGM display you are
using,
  31  *   there are 3 units supported EADOGM081 , EADOGM162 , EADOGM163 To
use
  32  *   define with a 1.
  33  *
  34  * #define EADOGM081 1  // to use MODEL EADOG081
  35  * #define EADOGM162 1  // to use MODEL EADOG162
  36  * #define EADOGM163 1  // to use MODEL EADOG163
  37  * #define EADOGMVDD  5   // 5v LCD Vdd
  38  * //#define EADOGMVDD  3   // 3.3v LCD Vdd
  39  *
  40  *
  41  * // we need to define the IO mode we want, select only one of
these, set to 1
  42  * #define EADOGM_SPI_HW  1   // hw spi, uses on chip spi
  43  * #define EADOGM_SPI_HW  2   // hw spi, 2nd on chip spi
  44  * #define EADOGM_SPI_DIV SPI_CLK_DIV_64 // used to slow hw spi clock
(you can use other constants)
  45  * #define EADOGM_SPI_SW  1   // sw bit bang, can use any io pins
  46  * #define EADOGM_8BIT    1   // 8 bit data bus
  47  *
  48  * // for 8Bit mode only, we need to define the output port
  49  * // however, this can be our own function if need be.
  50  * // example shows output to port b
  51  * #define EADOGM_8BIT_PORT(d) output_b(d);   // we need to define
how the byte goes out
  52  * //#define EADOGM_8BIT_PORT(d) your_func(d);   // we need to define
how the byte goes out
  53  *
  54  *
  55  * // we need to define a few pins
  56  * #define EADOGM_PIN_RS  PIN_C1   // RS line, (pin 39 on the LCD)
  57  * #define EADOGM_PIN_CSB PIN_C2   // /CSB line, (pin 38 on the LCD)
Req for SPI Opt for 8BIT
  58  *
  59  * // for 8 bit mode, we need to define a few more pins
  60  * #define EADOGM_NOCSB 1         // set to 1 if pin 38 (CSB) on lcd
is tied to Vss
  61  * #define EADOGM_PIN_E   PIN_C2   // E (pin 36 on the LCD)
  62  * #define EADOGM_PIN_RW  PIN_C6   // RW (pin 37 on the LCD)
  63  *
  64  * // set these if you are using EADOGM_SPI_SW (bit bang)
  65  * #define EADOGM_SCLK_BB PIN_C3 // Connects to pin 29 on LCD
  66  * #define EADOGM_MOSI_BB PIN_C5 // Connects to pin 28 on LCD
  67  *
  68  *
  69  *
  70  * #include "EA-DOGM_MIO.c"
  71  *
  72  *    In your main code, do an ini call
  73  * eaDogM_Initialize();
  74  * eaDogM_DisplayOn();
  75  *
  76  *
  77  * Available Functions:
  78  *
---------------------------------------------------------------------------
----
  79  *    eaDogM_Cls();                 // clears the screen, homes
cursor
  80  *    eaDogM_ClearRow(row);         // clears a row (v1.11)
  81  *    eaDogM_CursorOn();            // turns on the cursor
  82  *    eaDogM_CursorOff();           // turns of the cursor
  83  *    eaDogM_DisplayOn();           // turns on display with cursor
off
  84  *    eaDogM_DisplayOff();          // turns off display
  85  *    eaDogM_SetPos(row, col);      // sets position row:0-2,
col:0-15
  86  *    eaDogM_WriteChr(byte);        // writes a single chr to the
display
  87  *    eaDogM_WriteString(char str); // writes a string to the display
  88  *                                  // note: add this line after
device selection
  89  *                                  // to do this:
eaDogM_WriteString("Constant")
  90  *                                  //   #device PASS_STRINGS=IN_RAM
  91  *
  92  *    // writes a 2 digit integer at row,col set flag = 1 to disable
interrupts
  93  *    eaDogM_WriteIntAtPos(row,col,int[,flag])
  94  *
  95  *    // writes a string at row,col set flag = 1 to disable
interrupts
  96  *    eaDogM_WriteStringAtPos(row,col,char str[,flag])
  97  *
  98  *    eaDogM_SetContrast(c);      // set contrast 0 to 15
  99  *    eaDogM_DoubleHeight(row);     // turn on double height, row = 0
or 1
 100  *    eaDogM_DoubleHeightOff();     // turn off double height
 101  *
---------------------------------------------------------------------------
----
 102  *
 103  */
 104
 105
 106
 107 #ifndef EADOGM_SPI
 108    #define EADOGM_SPI 1
 109
 110 // some special symbol chrs defined
 111 #define EADMSYM_DEG     0b11011111     // degree symbol
 112 #define EADMSYM_DARWL   0b11111011     // double <<
 113 #define EADMSYM_DARWR   0b11111100     // double >>
 114 #define EADMSYM_LT      0b00111100     // less than <
 115 #define EADMSYM_GT      0b00111110     // greater than >
 116 #define EADMSYM_OHM     0b00011110     // ohm symbol
 117
 118 // some command defines
 119 #define EADMCMD_CONTRAST 0b0111000      // contrast command
(0b0111xxxx)
 120
 121
 122 // we noticed some issues with GLOBAL on pic24 devices
 123 #ifndef GLOBAL
 124   #define GLOBAL INTR_GLOBAL
 125 #endif
 126
 127
 128 // 1x16
 129 #ifdef EADOGM081
 130    #define EADOGM_ROWS 1
 131    #if EADOGMVDD == 5
 132      #define EADOGM_INIT_BIAS_SET 0x1C
 133      #define EADOGM_INIT_POWER_CONTROL 0x51
 134      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6A
 135      #define EADOGM_INIT_CONTRAST_SET 0x74
 136    #else
 137      #define EADOGM_INIT_BIAS_SET 0x14
 138      #define EADOGM_INIT_POWER_CONTROL 0x55
 139      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6D
 140      #define EADOGM_INIT_CONTRAST_SET 0x7C
 141    #endif
 142
 143    #define EADOGM_INIT_FS1 0x31
 144    #define EADOGM_INIT_FS2 0x30
 145    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
 146    #define EADOGM_INIT_ENTRY_MODE 0x06
 147    #define EADOGM_COLSPAN 16
 148 #endif
 149
 150
 151 // 2x16
 152 #ifdef EADOGM162
 153    #define EADOGM_ROWS 2
 154     #if EADOGMVDD == 5
 155      #define EADOGM_INIT_BIAS_SET 0x1C
 156      #define EADOGM_INIT_POWER_CONTROL 0x52
 157      #define EADOGM_INIT_FOLLOWER_CONTROL 0x69
 158      #define EADOGM_INIT_CONTRAST_SET 0x74
 159    #else
 160      #define EADOGM_INIT_BIAS_SET 0x14
 161      #define EADOGM_INIT_POWER_CONTROL 0x55
 162      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6D
 163      #define EADOGM_INIT_CONTRAST_SET 0x78
 164    #endif
 165
 166    #define EADOGM_INIT_FS1 0x39
 167    #define EADOGM_INIT_FS2 0x38
 168    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
 169    #define EADOGM_INIT_ENTRY_MODE 0x06
 170    #define EADOGM_COLSPAN 40  // suggested that this be 40 on model
162
 171 #endif
 172
 173 // 3x16
 174 #ifdef EADOGM163
 175    #define EADOGM_ROWS 3
 176     #if EADOGMVDD == 5
 177      #define EADOGM_INIT_BIAS_SET 0x1D
 178      #define EADOGM_INIT_POWER_CONTROL 0x50
 179      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6C
 180      #define EADOGM_INIT_CONTRAST_SET 0x7C
 181    #else
 182      #define EADOGM_INIT_BIAS_SET 0x15
 183      #define EADOGM_INIT_POWER_CONTROL 0x55
 184      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6E
 185      #define EADOGM_INIT_CONTRAST_SET 0x72
 186    #endif
 187
 188    #define EADOGM_INIT_FS1 0x39
 189    #define EADOGM_INIT_FS2 0x38
 190    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
 191    #define EADOGM_INIT_ENTRY_MODE 0x06
 192    #define EADOGM_COLSPAN 16
 193 #endif
 194
 195
 196 #define EADOGM_CMD_CLR 1
 197 #define EADOGM_CMD_CURSOR_ON     0b00001111
 198 #define EADOGM_CMD_CURSOR_OFF    0b00001100
 199 #define EADOGM_CMD_DISPLAY_ON    0b00001100
 200 #define EADOGM_CMD_DISPLAY_OFF   0b00001000
 201 #define EADOGM_CMD_DDRAM_ADDR    0b10000000
 202 #define EADOGM_CMD_CGRAM_ADDR    0b01000000
 203 #define EADOGM_CMD_SELECT_R0     0b00011000
 204 #define EADOGM_CMD_SELECT_R1     0b00010000
 205 #define EADOGM_CMD_SET_TABLE2    0b00101010
 206
 207
 208 // spi hw clock div, v2.03 fix
 209 #ifndef EADOGM_SPI_DIV
 210    #define EADOGM_SPI_DIV SPI_CLK_DIV_4
 211 #endif
 212
 213
 214
 215 // sw spi emulation routine (bit bang)
 216 #ifdef EADOGM_SPI_SW
 217    #ifndef EADOGM_SCLK_BB
 218      #define EADOGM_SCLK_BB PIN_C3
 219    #endif
 220    #ifndef EADOGM_MOSI_BB
 221      #define EADOGM_MOSI_BB PIN_C5
 222    #endif
 223
 224
 225 void eaDogM_iniSPI_BB(void)
 226 {
 227    output_drive(EADOGM_SCLK_BB);
 228    output_drive(EADOGM_MOSI_BB);
 229    output_low(EADOGM_SCLK_BB);
 230    output_low(EADOGM_MOSI_BB);
 231 }
 232
 233 void eaDogM_spiWrite_BB(int8 regData)
 234 {
 235
 236   int1 bitOut;
 237   int8 SPICount;                               // Counter used to
clock out the data
 238   int8 SPIData;                                // Define a data
structure for the SPI data.
 239
 240   output_low(EADOGM_SCLK_BB);                         // and CK low
 241
 242   SPIData = regData;
 243   for (SPICount = 0; SPICount < 8; SPICount++) // Prepare to clock
out the Address byte
 244     {
 245     bitOut = bit_test(SPIData,7);
 246     output_bit(EADOGM_MOSI_BB,bitOut);
 247     output_high(EADOGM_SCLK_BB);                      // Toggle the
clock line
 248     //delay_us(10);
 249     output_low(EADOGM_SCLK_BB);
 250     //delay_us(10);
 251     SPIData = SPIData << 1;                    // Rotate to get the
next bit
 252     }                                          // and loop back to
send the next bit
 253
 254   output_low(EADOGM_MOSI_BB);
 255 }
 256
 257 // wrapper for sw spi calls in main program
 258 // v2.01 moved to macro define
 259 #define eaDogM_outSPI(c) eaDogM_spiWrite_BB(c)
 260 #endif
 261
 262 // wrapper for hw spi calls in main program
 263 // v2.01 moved to a macro define
 264 #if EADOGM_SPI_HW == 1
 265    #define eaDogM_outSPI(c) spi_write(c)
 266 #endif
 267
 268 // wrapper for hw2 spi calls in main program
 269 // v2.01 moved to a macro define, v2.03 using EADOGM_SPI_HW to test
condition
 270 #if EADOGM_SPI_HW == 2
 271    #define eaDogM_outSPI(c) spi_write2(c)
 272 #endif
 273
 274
 275 #ifdef EADOGM_8BIT
 276 void eaDogM_ini8Bit(void)
 277 {
 278 #ifndef EADOGM_NOCSB
 279    output_drive(EADOGM_PIN_CSB);
 280    output_high(EADOGM_PIN_CSB);
 281 #endif
 282    output_drive(EADOGM_PIN_E);
 283    output_drive(EADOGM_PIN_RW);
 284    output_drive(EADOGM_PIN_RS);
 285    output_low(EADOGM_PIN_E);
 286    output_low(EADOGM_PIN_RS);
 287    output_low(EADOGM_PIN_RW);
 288 }
 289 #endif
 290
 291
 292
 293 #ifdef EADOGM_8BIT
 294 // 8bit mode
 295 void eaDogM_WriteChr(char value)
 296 {
 297    output_high(EADOGM_PIN_RS);
 298    output_low(EADOGM_PIN_RW);
 299    output_low(EADOGM_PIN_E);
 300    #ifndef EADOGM_NOCSB
 301      output_low(EADOGM_PIN_CSB);
 302      #endif
 303    output_high(EADOGM_PIN_E);
 304    delay_ms(1);
 305    EADOGM_8BIT_PORT(value);
 306    output_low(EADOGM_PIN_E);
 307    delay_ms(1);
 308    #ifndef EADOGM_NOCSB
 309      output_low(EADOGM_PIN_CSB);
 310      #endif
 311    delay_ms(1);
 312 }
 313
 314 void eaDogM_WriteCommand(int8 cmd)
 315 {
 316    output_low(EADOGM_PIN_RS);
 317    output_low(EADOGM_PIN_RW);
 318    output_low(EADOGM_PIN_E);
 319    #ifndef EADOGM_NOCSB
 320      output_low(EADOGM_PIN_CSB);
 321      #endif
 322    output_high(EADOGM_PIN_E);
 323    delay_ms(1);
 324    EADOGM_8BIT_PORT(cmd);
 325    output_low(EADOGM_PIN_E);
 326    delay_ms(1);
 327    #ifndef EADOGM_NOCSB
 328      output_low(EADOGM_PIN_CSB);
 329      #endif
 330    delay_ms(1);
 331 }
 332 #else
 333 // spi mode
 334 void eaDogM_WriteChr(char value)
 335 {
 336    output_high(EADOGM_PIN_RS);
 337    output_low(EADOGM_PIN_CSB);
 338    eaDogM_outSPI(value);
 339    output_high(EADOGM_PIN_CSB);
 340    delay_ms(1);
 341 }
 342
 343 void eaDogM_WriteCommand(int8 cmd)
 344 {
 345    output_low(EADOGM_PIN_RS);
 346    output_low(EADOGM_PIN_CSB);
 347    eaDogM_outSPI(cmd);
 348    output_high(EADOGM_PIN_CSB);
 349    delay_ms(1);
 350 }
 351 #endif
 352
 353
 354 void eaDogM_Initialize(void)
 355 {
 356
 357 // v2.03 fix
 358 #if EADOGM_SPI_HW  == 1
 359    setup_spi( SPI_MASTER | SPI_H_TO_L | EADOGM_SPI_DIV );
 360 #endif
 361
 362 // v2.03 fix
 363 #if EADOGM_SPI_HW  == 2
 364    setup_spi2( SPI_MASTER | SPI_H_TO_L | EADOGM_SPI_DIV );
 365 #endif
 366
 367 #ifdef EADOGM_SPI_SW
 368    eaDogM_iniSPI_BB();
 369 #endif
 370
 371 #ifdef EADOGM_8BIT
 372    eaDogM_ini8Bit();
 373 #else
 374    output_drive(EADOGM_PIN_CSB);
 375    output_drive(EADOGM_PIN_RS);
 376    output_high(EADOGM_PIN_CSB);
 377    output_high(EADOGM_PIN_RS);
 378 #endif
 379
 380    delay_ms(200);
 381
 382    eaDogM_WriteCommand(EADOGM_INIT_FS1);
 383    eaDogM_WriteCommand(EADOGM_INIT_BIAS_SET);
 384    eaDogM_WriteCommand(EADOGM_INIT_POWER_CONTROL);
 385    eaDogM_WriteCommand(EADOGM_INIT_FOLLOWER_CONTROL);
 386    eaDogM_WriteCommand(EADOGM_INIT_CONTRAST_SET);
 387    eaDogM_WriteCommand(EADOGM_INIT_FS2);
 388    eaDogM_WriteCommand(EADOGM_INIT_CLEAR_DISPLAY);
 389    eaDogM_WriteCommand(EADOGM_INIT_ENTRY_MODE);
 390
 391 }
 392
 393 // sets contrast, call with a value from 0 to 15
 394 // we also mask off upper 4 bits from c
 395 // v2.01 moved to a macro define
 396 #define eaDogM_SetContrast(c) eaDogM_WriteCommand(EADMCMD_CONTRAST +
(c & 0b00001111))
 397
 398 // only tested on 3 line display at the moment,
 399 // thus no constants defined. when fully tested, I will define them
 400 void eaDogM_DoubleHeight(int8 row) // row 0 or 1
 401 {
 402    eaDogM_WriteCommand(EADOGM_CMD_SET_TABLE2); // set instruction
table 2
 403    if (row == 0) {
 404      eaDogM_WriteCommand(EADOGM_CMD_SELECT_R0); // select row 0
 405      }
 406    if (row == 1) {
 407      eaDogM_WriteCommand(EADOGM_CMD_SELECT_R1); // select row 1
 408      }
 409    eaDogM_WriteCommand(0b00101100); // turns on double line mode
 410                                     // and set instruction table back
to 0
 411 }
 412
 413 // v2.01 moved functions to macros
 414 #define eaDogM_DoubleHeightOff() eaDogM_WriteCommand(0b00101000)
 415 #define eaDogM_Cls()             eaDogM_WriteCommand(EADOGM_CMD_CLR)
 416 #define eaDogM_CursorOn()
eaDogM_WriteCommand(EADOGM_CMD_CURSOR_ON)
 417 #define eaDogM_CursorOff()
eaDogM_WriteCommand(EADOGM_CMD_CURSOR_OFF)
 418 #define eaDogM_DisplayOn()
eaDogM_WriteCommand(EADOGM_CMD_DISPLAY_ON)
 419 #define eaDogM_DisplayOff()
eaDogM_WriteCommand(EADOGM_CMD_DISPLAY_OFF)
 420
 421
 422 void eaDogM_SetPos(int8 r, int8 c)
 423 {
 424    int8 cmdPos;
 425    cmdPos = EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN) + c;
 426    eaDogM_WriteCommand(cmdPos);
 427 }
 428
 429 void eaDogM_ClearRow(int8 r)
 430 {
 431    int8 i;
 432    eaDogM_SetPos(r,0);
 433    for(i=0; i<EADOGM_COLSPAN; i++) {
 434      eaDogM_WriteChr(' ');
 435    }
 436 }
 437
 438 void eaDogM_WriteString(char *strPtr)
 439 {
 440    printf(eaDogM_WriteChr,"%s",strPtr);
 441 }
 442
 443
 444 // Optional DisGIE, set to 1 to disable interrupts
 445 // v1.4 -- provided by Imaginos
 446 void eaDogM_WriteStringAtPos(int8 r, int8 c, char *strPtr, int1
DisGIE=0)
 447 {
 448    if (DisGIE) {
 449       disable_interrupts(GLOBAL);
 450       }
 451
 452    eaDogM_WriteCommand((EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN)
+ c));
 453    printf(eaDogM_WriteChr,"%s",strPtr);
 454
 455    if (DisGIE) {
 456       enable_interrupts(GLOBAL);
 457       }
 458 }
 459
 460 // Optional DisGIE, set to 1 to disable interrupts
 461 // v1.4 -- provided by Imaginos
 462 void eaDogM_WriteIntAtPos(int8 r, int8 c, int8 i, int1 DisGIE=0)
 463 {
 464    if (DisGIE) {
 465       disable_interrupts(GLOBAL);
 466       }
 467
 468    eaDogM_WriteCommand((EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN)
+ c));
 469
 470    eaDogM_WriteChr(i/10+'0');
 471    eaDogM_WriteChr(i%10+'0');
 472
 473    if (DisGIE) {
 474       enable_interrupts(GLOBAL);
 475       }
 476 }
 477
 478 // this writes a byte to the internal CGRAM (v2.02)
 479 // format for ndx: 00CCCRRR = CCC = character 0 to 7, RRR = row 0 to
7
 480 void eaDogM_WriteByteToCGRAM(char ndx, char data)
 481 {
 482    unsigned int cmd;
 483
 484    cmd = ndx & 0b00111111; // mask off upper to bits
 485    cmd = cmd | EADOGM_CMD_CGRAM_ADDR; // set bit cmd bits
 486
 487    eaDogM_WriteCommand(cmd);
 488    eaDogM_WriteChr(data);
 489
 490    // this is done to make sure we are back in data mode
 491    eaDogM_SetPos(0,0);
 492 }
 493
 494
 495 #endif


--
cdb, KILLspamcolinKILLspamspambtech-online.co.uk on 12/04/2011

Web presence: http://www.btech-online.co.uk

Hosted by:  http://www.justhost.com.au


"For those who believe, no proof is necessary. For those who don't believe,
no proof is possible." - Stuart Chase


2011\04\12@034315 by Michael Rigby-Jones

flavicon
face
> -----Original Message-----
> From: RemoveMEpiclist-bouncesTakeThisOuTspammit.edu [spamBeGonepiclist-bouncesspamBeGonespammit.edu] On
Behalf
> Of cdb
> Sent: 12 April 2011 08:06
> To: Microcontroller discussion list - Public.
> Subject: Re: [EE] DOGM LCD
>
> My research seems to point out that the main difficulty is configuring
the
> TWO control registers which differ depending on the Vcc and model.
after
> which 44780 code works with no problem.
>
> I've discovered what looks like to be the most complete working code
yet
> on
> the CCS-Info forum, this even caters for the 5v and 3v3 and several
> different models.
>
> <snip>

The original source files are available at
http://www.mculabs.com/drivers/eadogm.html

Regards

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

2011\04\12@092207 by IVP

face picon face
> I've discovered what looks like to be the most complete working
> code yet

Colin, would you agree below are the relevant bits for 16x2, 5V,
8-bit. 371 - 389 looks to me to be the initialisation sequence

What is the difference between output_drive and output_high ?

  35  * #define EADOGM162 1  // to use MODEL EADOG162
  37  * #define EADOGMVDD  5   // 5v LCD Vdd
  46  * #define EADOGM_8BIT    1   // 8 bit data bus

 152 #ifdef EADOGM162
 153    #define EADOGM_ROWS 2
 154     #if EADOGMVDD == 5
 155      #define EADOGM_INIT_BIAS_SET 0x1C
 156      #define EADOGM_INIT_POWER_CONTROL 0x52
 157      #define EADOGM_INIT_FOLLOWER_CONTROL 0x69
 158      #define EADOGM_INIT_CONTRAST_SET 0x74

 166    #define EADOGM_INIT_FS1 0x39
 167    #define EADOGM_INIT_FS2 0x38
 168    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
 169    #define EADOGM_INIT_ENTRY_MODE 0x06
 170    #define EADOGM_COLSPAN 40  // this be 40 on 162
 171 #endif
  196 #define EADOGM_CMD_CLR 1
 197 #define EADOGM_CMD_CURSOR_ON     0b00001111
 198 #define EADOGM_CMD_CURSOR_OFF    0b00001100
 199 #define EADOGM_CMD_DISPLAY_ON    0b00001100
 200 #define EADOGM_CMD_DISPLAY_OFF   0b00001000
 201 #define EADOGM_CMD_DDRAM_ADDR    0b10000000
 202 #define EADOGM_CMD_CGRAM_ADDR    0b01000000
 203 #define EADOGM_CMD_SELECT_R0     0b00011000
 204 #define EADOGM_CMD_SELECT_R1     0b00010000
 205 #define EADOGM_CMD_SET_TABLE2    0b00101010

 275 #ifdef EADOGM_8BIT
 276 void eaDogM_ini8Bit(void)
 277 {
 278 #ifndef EADOGM_NOCSB
 279    output_drive(EADOGM_PIN_CSB);
 280    output_high(EADOGM_PIN_CSB);
 281 #endif
 282    output_drive(EADOGM_PIN_E);
 283    output_drive(EADOGM_PIN_RW);
 284    output_drive(EADOGM_PIN_RS);
 285    output_low(EADOGM_PIN_E);
 286    output_low(EADOGM_PIN_RS);
 287    output_low(EADOGM_PIN_RW);
 288 }
 289 #endif
 290   291   292   293 #ifdef EADOGM_8BIT
 294 // 8bit mode
 295 void eaDogM_WriteChr(char value)
 296 {
 297    output_high(EADOGM_PIN_RS);
 298    output_low(EADOGM_PIN_RW);
 299    output_low(EADOGM_PIN_E);
 300    #ifndef EADOGM_NOCSB
 301      output_low(EADOGM_PIN_CSB);
 302      #endif
 303    output_high(EADOGM_PIN_E);
 304    delay_ms(1);
 305    EADOGM_8BIT_PORT(value);
 306    output_low(EADOGM_PIN_E);
 307    delay_ms(1);
 308    #ifndef EADOGM_NOCSB
 309      output_low(EADOGM_PIN_CSB);
 310      #endif
 311    delay_ms(1);
 312 }
 313   314 void eaDogM_WriteCommand(int8 cmd)
 315 {
 316    output_low(EADOGM_PIN_RS);
 317    output_low(EADOGM_PIN_RW);
 318    output_low(EADOGM_PIN_E);
 319    #ifndef EADOGM_NOCSB
 320      output_low(EADOGM_PIN_CSB);
 321      #endif
 322    output_high(EADOGM_PIN_E);
 323    delay_ms(1);
 324    EADOGM_8BIT_PORT(cmd);
 325    output_low(EADOGM_PIN_E);
 326    delay_ms(1);
 327    #ifndef EADOGM_NOCSB
 328      output_low(EADOGM_PIN_CSB);
 329      #endif
 330    delay_ms(1);
 331 }

 371 #ifdef EADOGM_8BIT
 372    eaDogM_ini8Bit();
 373 #else
 374    output_drive(EADOGM_PIN_CSB);
 375    output_drive(EADOGM_PIN_RS);
 376    output_high(EADOGM_PIN_CSB);
 377    output_high(EADOGM_PIN_RS);
 378 #endif
 379   380    delay_ms(200);
 381   382    eaDogM_WriteCommand(EADOGM_INIT_FS1);
 383    eaDogM_WriteCommand(EADOGM_INIT_BIAS_SET);
 384    eaDogM_WriteCommand(EADOGM_INIT_POWER_CONTROL);
 385    eaDogM_WriteCommand(EADOGM_INIT_FOLLOWER_CONTROL);
 386    eaDogM_WriteCommand(EADOGM_INIT_CONTRAST_SET);
 387    eaDogM_WriteCommand(EADOGM_INIT_FS2);
 388    eaDogM_WriteCommand(EADOGM_INIT_CLEAR_DISPLAY);
 389    eaDogM_WriteCommand(EADOGM_INIT_ENTRY_MODE);
 390   391 }
 392   393 // sets contrast, call with a value from 0 to 15
 394 // we also mask off upper 4 bits from c
 395 // v2.01 moved to a macro define
 396 #define eaDogM_SetContrast(c) eaDogM_WriteCommand(EADMCMD_CONTRAST + (c & 0b00001111)

2011\04\12@161051 by cdb

flavicon
face
Joe,

:: What is the difference between output_drive and output_high ?

I don't use CCS, but I'm pretty sure output_drive is setting the pins DDR register to output - just downloaded the manual, it is the TRISx statement, and of course output_high sets it to output a 1.

Yes, 371-381 is the initialise sequencefor 5v 2 line.

Colin
--
cdb, TakeThisOuTcolinEraseMEspamspam_OUTbtech-online.co.uk on 13/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 

2011\04\12@205936 by IVP

face picon face
> I've discovered what looks like to be the most complete working
> code yet

Nothing like the datasheet, but **** me it actually works

Thanks. And the display thanks you for a fate worse than bin

Someone must have done an awful lot of experimenting or got lucky

I'm going to pull those routines apart and find out specifically what
makes it work. Those 1ms delays are probably unnecessarily long
for example

As I interpret the C

function1 = 0x39
function2 = 0x38
bias      = 0x1c
power     = 0x52
follower  = 0x69
contrast  = 0x74
disp_on   = 0x0c
clear     = 0x01
entry     = 0x06

;================================================
;        Initialise LCD screen (8-bit, 5V)
;================================================

lcd_init movlw  function1
        call   writec
        movlw  bias
        call   writec
        movlw  power
        call   writec
        movlw  follower
        call   writec
        movlw  contrast
        call   writec
        movlw  function2
        call   writec
        movlw  disp_on
        call   writec
        movlw  clear
        call   writec
        movlw  entry
        call   writec
        return

writec   bcf    rs
        bcf    rw
        bcf    en
        bsf    en
        call   ms01
        movwf  latc
        bcf    en
        call   ms01
        call   ms01
        return

writed   bsf    rs
        bcf    rw
        bcf    en
        bsf    en
        call   ms01
        movwf  latc
        bcf    en
        call   ms01
        return

To display characters

        movlw   " "
        call    writed
        movlw   "E"
        call    writed
        movlw   "A"
        call    writed

Here's what the code does, pin-wise

http://home.clear.net.nz/pages/joecolquitt/dogm_works.gif

Note, again, that R/W initiates Busy, which is useless after that

And looks like

http://home.clear.net.nz/pages/joecolquitt/dogm_message_1.jpg

Will post code adventures

Many Cheers. You guys eh, you guys

Jo

2011\04\12@214450 by Oli Glaser

flavicon
face
On 13/04/2011 01:57, IVP wrote:
>> I've discovered what looks like to be the most complete working
>> >  code yet
> Nothing like the datasheet, but **** me it actually works
>

Hooray!
Well done for persevering, sounds like it put up a real fight..


> Thanks. And the display thanks you for a fate worse than bin
>
> Someone must have done an awful lot of experimenting or got lucky
>
> I'm going to pull those routines apart and find out specifically what
> makes it work. Those 1ms delays are probably unnecessarily long
> for example

Good luck, probably involves magic incantations and dead fish..  ;-)
If you do figure it out, maybe let EA know if it's that far out from the datasheet so they can fix it, and/or put some example code on their site.

2011\04\12@214828 by Marcel Duchamp

picon face
>
> Many Cheers. You guys eh, you guys
>
> Joe

Perseverance and the Piclist... good for you

2011\04\12@222152 by IVP

face picon face
> Well done for persevering, sounds like it put up a real fight

It did, and it ain't done yet

I'm looking at the delays during the initialisation. Yes, you can
reduce them to about 100us but whether you see anything is
still dependent on the control lines. For example resetting the
PIC works OK but a cold start gives a blank screen. Similarly
timing during the power-up determines whether the PIC needs
to send a reset, so there's still some unknowns

Forget the datasheet though I think

> and/or put some example code on their site.

Yes, I'd hope to do that as soon as I get something definitive
and repeatable

> Perseverance and the Piclist... good for you

'kin oath it is ;-)

Jo

2011\04\13@033653 by cdb

flavicon
face


:: movlw  disp_on
:: call   writec
:: disp_on   = 0x0c

Joe,
I notice that you write a display_on command and he doesn't in the initialisation code.

Colin


--
cdb, RemoveMEcolinspamTakeThisOuTbtech-online.co.uk on 13/04/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 

2011\04\13@064017 by IVP

face picon face
> :: movlw  disp_on
> :: call   writec
> :: disp_on   = 0x0c
>
> Joe,
>
> I notice that you write a display_on command and he doesn't
> in the initialisation code.

You can't see anything otherwise. Take the disp_on out and the
screen is blank. The initialisation sequence is important. If you
move function2 up the order for example, no deal. Certainly if
you put it straight after function1, as in the documentation, you'll
get nowt. Fiddle with the order and sometimes you'll get faint
characters, sometimes blank

I've started a page

http://home.clear.net.nz/pages/joecolquitt/dogm_lcd.html

The message is what I'll include if EA host the code as a PIC
example

The space behind the display and its transparency opens up all
sorts of possibilities. I've included a multi-use PCB pattern which
can be wired up with the 6 options here

http://www.lcd-module.de/eng/pdf/doma/dog-me.pdf

Note the solder bridging gaps available

Now....

Tossing up whether to be a'tinkering or a'cleaning up four days
of toe-stubbing mess. Hmmmm

Jo

2011\04\16@035038 by IVP

face picon face
Hi all,

I think this will be it unless I discover anything exciting to add

http://home.clear.net.nz/pages/joecolquitt/dogm_lcd.html

Jo

2011\04\16@143549 by Peter Loron

flavicon
face
Thanks, Joe! Good stuff.

-Pete

On Apr 16, 2011, at 12:46 AM, IVP wrote:

> Hi all,
>
> I think this will be it unless I discover anything exciting to add
>
> home.clear.net.nz/pages/joecolquitt/dogm_lcd.html
>
> Joe
> -

More... (looser matching)
- Last day of these posts
- In 2011 , 2012 only
- Today
- New search...