PDA

View Full Version : EA-DOGM-163 with ST7036 LCD controller - can't find address for line 2 and 3



flotulopex
- 7th August 2016, 19:46
Hello,

I'm playing around with a EA-DOGM-163 (http://www.lcd-module.com/products/dog.html) LCD (16 characters, 3 lines).
8282
This LCD is equipped with a ST7036 controller (http://www.lcd-module.com/eng/pdf/zubehoer/st7036.pdf).

For tests, I have built my project and made this display work with an 8 bits bus - and it works :smile: ...at least, only the first line is okay.

But when it comes to display some text on a specific line, I can't achieve it.

' ====== FUSES ================================================== ===================================
' PIC 16F690
@ __Config _FCMEN_OFF &_IESO_OFF &_CPD_OFF &_WDT_OFF &_HS_OSC &_BOR_OFF &_CP_OFF &_PWRTE_OFF &_MCLRE_OFF

' ====== REGISTERS ================================================== ===============================
' 76543210
OPTION_REG = %10000000 ' PORT A&B Pull-Ups (look WPUA & WPUB)
ANSEL = %00000000 ' Analog inputs Channels 0 to 7
ANSELH = %00000000 ' Analog inputs Channels 8 to 11
ADCON0 = %00000000 ' A/D Module is OFF
CM1CON0 = %00000000 ' Comparator1 Module is OFF
CM2CON0 = %00000000 ' Comparator2 Module is OFF
INTCON = %00000000 ' INTerrupts CONtrol
PORTA = %00000000 ' Ports High/Low (0 to 5)
TRISA = %00000000 ' Set Input/Output (0 to 5)
PORTB = %00000000 ' Ports High/Low (4 to 7)
TRISB = %00000000 ' Set Input/Output (4 to 7)
PORTC = %00000000 ' Ports High/Low (0 to 7)
TRISC = %00000000 ' Set Input/Output (0 to 7)

' ====== DEFINES ================================================== ===============================
DEFINE OSC 8

DEFINE LCD_DREG PORTC ' LCD data port
DEFINE LCD_DBIT 0 ' LCD data starting PORT.bit (0 or 4)
DEFINE LCD_RSREG PORTB ' LCD register select port
DEFINE LCD_RSBIT 4 ' LCD register select bit
DEFINE LCD_EREG PORTB ' LCD enable port
DEFINE LCD_EBIT 6 ' LCD enable bit
DEFINE LCD_BITS 8 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 3 ' Number lines on LCD

' ====== INITIALIZATION ================================================== =================================
' EA-DOG-Mx settings
PAUSE 1000 'Time to power-up this display (THIS IS CRUCIAL!!!)
LCDOUT $FE, $39 'Function Set: 8 bits bus mode
LCDOUT $FE, $1D 'Bias set, 3-lines display (5V=$1D / 3,3V=$15)
LCDOUT $FE, $52 'Power control + Contrast (HiByte) (5V=$52 / 3,3V=55)
LCDOUT $FE, $69 'Follower control (5V=$69 / 3,3V=6D)
LCDOUT $FE, $70 'Contrast (LowByte)
LCDOUT $FE, $38 'Function Set: switch back to instruction table 0

' ====== PROGRAM ================================================== =================================
' Program
MAIN:

LCDOUT $FE, 1 ' clear display
LCDOUT $FE, 2,"1" ' beginning of line 1
LCDOUT $FE,$10,"2" ' beginning of line 2
LCDOUT $FE,$20,"3" ' beginning of line 3

END

According to the controller's datasheet, ST7036 is instruction compatible with HD44780. But if I try to use values like $C0 (beginning of second line) or $94 (beginning of third line), it won't work.
8284

Looking again in the ST7036's datasheet, page 20, one can read this:
8287

So, as it is now in my code, I used $10 and $20 values...but it still doesn't work.

Anyone an idea where I'm wrong?

Scampy
- 7th August 2016, 23:30
Roger,

I'm no expert, but most of the routines I've seen and used in PBP tend to use 4 bit mode for HD44780 based LCD's so maybe the following might help (?) - you may need to change some pins to match your hardware



DEFINE LCD_DREG PORTB ' LCD Data port
DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4)
DEFINE LCD_EREG PORTB ' LCD Enable port
DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB ' LCD Register Select port
DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD)
DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 3 ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us

richard
- 8th August 2016, 03:43
Set DDRAMAddress 1 AC6 AC5 AC4 AC3 AC2 AC1 AC0

try this , looks like you need to set bit 7 and add dram ADDRESS

LCDOUT $FE, 1 ' clear display
LCDOUT $FE, 130,"1" ' beginning of line 1
LCDOUT $FE,$90,"2" ' beginning of line 2
LCDOUT $FE,$a0,"3" ' beginning of line 3

flotulopex
- 8th August 2016, 15:42
Thanks a lot Richard,

It works now as expected with this code:
LCDOUT $FE, 1 ' clear display
LCDOUT $FE, 2,"1" ' beginning of line 1
LCDOUT $FE,$90,"2" ' beginning of line 2
LCDOUT $FE,$A0,"3" ' beginning of line 3
May I kindly ask you to explain how you found out those values please?



looks like you need to set bit 7 and add dram ADDRESSHum...I don't get this; what do you mean?

richard
- 8th August 2016, 23:58
May I kindly ask you to explain how you found out those values please?

bit 7 = 128 =$80


hex dec
row1 dram address = 0 0 128 + 0 = 128 = $80
row2 dram address = $10 16 128 +16 = 144 = $90
row3 dram address = $20 32 128 +32 = 160 = $A0

flotulopex
- 9th August 2016, 16:40
Thank you again Richard.

My knowledge of the "datasheet language" is apparently still poor :o

Can you tell where this info is to be found in there?

I'm lucky I've got you helping me (thanks again), but it's so frustrating not being able to find this by myself ...you know what I mean :rolleyes:

richard
- 9th August 2016, 23:32
from st7036 data sheet

flotulopex
- 10th August 2016, 07:19
Thank you Richard.

Obviously, I have some lacks in basic knowledge of "display's controller" science since I can't still correlate your information and how I should understand it affects the cursor's position on the display :frown:

I stop bothering you now; you gave me the solution and I thank you very much again for it ;)

flotulopex
- 21st August 2016, 18:15
The controller contains n bytes of Display Data Random Access Memory which is usually referred to as DDRAM.

Each of these DDRAM memory addresses corresponds to a character position on an attached display, but the specific position varies depending on the configuration of that display.

This is what I was missing and this info can be found here (http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html) :smile: