LCDOUT custom commands - how to?


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    943


    Did you find this post helpful? Yes | No

    Default LCD Write?

    Yes, really handy. Thanks a lot again.

    I would appreciate to find some more explanations on how to read (understand) and write to the display the configuration commands such as LCDOUT $FE, xxx.

    Merci encore.
    Roger

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    943


    Did you find this post helpful? Yes | No

    Default Contrast to be set - yes, but how?

    I've got an answer from ELECTRONIC ASSEMBLY (EA). They say this display is fully HD4470 compatible.

    So, until the contrast (all the display in fact) is not initialised properly, nothing will happen on the display.

    I've got this table extracted from the PDF file I inserted in my first post:


    This example is for a 8 bits display. I would prefer to use it with 4 bits but if it is easier to start this way...

    Can somebody tell me what syntax I have to use to modify the contrast settings?

    Is it LCDOUT $FE, $74? I tried this already but nothing happened.

    I don't understand how to use this table. Could somebody explain me please?

    BTW, EA also sent me some assembly examples (see attachments); for those who understand this, it may help, maybe. Unfortunately, I don't know assembler...

    Mister_e, see the picture? Thanks you, again ;-)
    Attached Files Attached Files
    Last edited by flotulopex; - 26th November 2006 at 13:34.
    Roger

  3. #3
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Take a look at http://www.lcd-module.de/eng/pdf/zubehoer/st7036.pdf

    Pages 34-38 tell you exactly what each register contains and what each bit does.

    Page 39 shows 8 bit initialisation

    Page 41 shows 4 bit initialistaion but you dont need to go down to that lave. PBP should take care of that for you.

    Just look for the commands that set the contrast. It look to be "$7x" where x is the setting 0-F for the 16 possible values.

    I would follow Steves advice for leaving a long delay after the first initialistaion command then try something like this
    Code:
    contrast             var byte
    contrastcommand var byte
    
    
    
    For contrast = 0 to 15
       contrastcommand = $70 + contrast
       LCDout $FE, contrastcommand
       pause 10
       LCDout $FE,1, "contrast=", DEC2 contrast
       pause 1000
    Next
    That should send all possible values to the LCD for adjusting the contrast and if it works you will see on the display the values that give a visible display. Then pick the best one.

    Cant really offer much more as I dont have that type of display.
    Keith

    www.diyha.co.uk
    www.kat5.tv

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    943


    Did you find this post helpful? Yes | No

    Default let's try this

    Okay.

    I'll go back to my breadboard and try.

    Come back asap.
    Roger

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    943


    Did you find this post helpful? Yes | No

    Default ...

    I did almost everything all of you suggested.

    Still nothing works; the display is just not showing anything.

    I even tried to reverse the bus order (sorry Melanie) since the guy from EA said this would be so (but I can't believe it - D0 on display should be connected to DB0 and so on, for sure).

    Ii is now sunday 15:45 local time and I won't be able to have news before tomorrow morning.

    So, let's wait a little...
    Roger

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Can you try...
    Code:
    ' Register settings
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    
    
    ManualLCDInit:
        FLAGS=2  ' Void PBP lcd initialisation... it's a nice feature !!!
        PAUSE 500
        Lcdout $FE, $30
        Lcdout $FE, $30
        Lcdout $FE, $30
        Lcdout $FE, $20 ' official 4 bit mode
        Lcdout $FE, $28 ' Function Set
        Lcdout $FE, $14 ' Bias
        Lcdout $FE, $78 ' Contrast set
        Lcdout $FE, $5E ' Power/Icon/Contrast
        Lcdout $FE, $6A ' Follower control
        Lcdout $FE, $0C ' Display ON
        Lcdout $FE, $01 ' Clear display
        Lcdout $FE, $06 ' Entry mode Set
       ' --------------------------------- End LCD init!
    
        LCDOUT $FE,1,"Line1",$FE,$C0,"Line 2"
    Pouet: 
        Goto Pouet
    there's still some more code efficient solutions so far..
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Lightbulb

    Hey Steve.

    I could be wrong, but I think it needs a fix.

    The LCD will Power-up in 8-bit mode, but PBP will still be sending 4-bit.
    So each nibble acts as a full command.
    If you use $33 (twice), then it will get the "reset" 4 times, instead of $30,$00,$30,$00 ...

    Then when it switches to 4-bit mode, it receives an extra nibble from the $20 which puts it out of sync with the rest of the data. By pulsing the E pin once it clocks in another $0 which is a "nothing" command and puts it back in sync.

    Like this ...
    Code:
    ManualLCDInit:
        FLAGS=2  ' Void PBP lcd initialisation... it's a nice feature !!!
        PAUSE 500
        Lcdout $FE, $33
        Lcdout $FE, $33
        Lcdout $FE, $20 ' official 4 bit mode
        @  bsf LCD_EREG, LCD_EBIT
        PAUSEUS 20
        @  bcf LCD_EREG, LCD_EBIT
    
     ; -- rest is the same --
    DT

  8. #8
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    943


    Did you find this post helpful? Yes | No

    Thumbs up Functional example

    Hi,

    Just for an update, let me paste the code I use currently to make these kind of display working.

    Code:
    ' Code lines to be adapted according to 4 or 8 bits mode are marked " '// "
    
    ' LCD circuitry
    '23,24,25,26,40 - Vdd (+5V)
    '27,37,38 - Vss (GND)
    '35 DB0   - PORTC.0
    '34 DB1   - PORTC.1
    '33 DB3   - PORTC.2
    '32 DB4   - PORTC.3
    '31 DB4   - PORTC.4
    '30 DB5   - PORTC.5
    '29 DB6   - PORTC.6
    '28 DB7   - PORTC.7
    '39 RS    - PORTB.5
    '36 E     - PORTB.4
    
    '-------------------------------------------------------------------------------
    ' Fuses
    @ DEVICE PIC16F690,FCMEN_OFF
    @ DEVICE PIC16F690,IESO_OFF
    @ DEVICE PIC16F690,BOD_OFF
    @ DEVICE PIC16F690,CPD_OFF
    @ DEVICE PIC16F690,PROTECT_OFF
    @ DEVICE PIC16F690,MCLR_OFF
    @ DEVICE PIC16F690,PWRT_OFF
    @ DEVICE PIC16F690,WDT_OFF
    @ DEVICE PIC16F690,INTRC_OSC_NOCLKOUT
    
    '-------------------------------------------------------------------------------
    ' Registers   76543210
    OPTION_REG = %10000000 'PORT A&B Pull-Ups disabled (look WPUA & WPUB)
    ANSEL      = %00000000 'Disable analog inputs Channels 0 to 7
    ANSELH     = %00000000 'Disable 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
    TRISA      = %00000000 'Set Input/Output (0 to 5)
    PORTA      = %00000000 'Ports High/Low (0 to 5)
    TRISB      = %00000000 'Set Input/Output (4 to 7)
    PORTB      = %00000000 'Ports High/Low (4 to 7)
    TRISC      = %00000000 'Set Input/Output (0 to 7)
    PORTC      = %00000000 'Ports High/Low (0 to 7) - 8 bits
    '//PORTC      = %00001111 'Ports High/Low (0 to 7) - 4 bits
    
    '-------------------------------------------------------------------------------
    ' Defines
    DEFINE LCD_DREG PORTC   'LCD data port 
    DEFINE LCD_DBIT 0       'LCD data starting bit 0(8bits)
    '//DEFINE LCD_DBIT 4       'LCD data starting bit (4 bits)
    DEFINE LCD_RSREG PORTB  'LCD register select port
    DEFINE LCD_RSBIT 5      'LCD register select bit
    DEFINE LCD_EREG PORTB   'LCD enable port
    DEFINE LCD_EBIT 4       'LCD enable bit
    DEFINE LCD_BITS 8       'LCD bus size 8 bits
    '//DEFINE LCD_BITS 4       'LCD bus size 4 bits
    DEFINE LCD_LINES 2      'Number lines on LCD
    
    '-------------------------------------------------------------------------------
    ' Variables
    Contrast        var byte
    Contrastcommand var byte
    
    '-------------------------------------------------------------------------------
    ' Init display
    
    ' COG Mandatory settings
    pause 1000      'Time to settle Vdd (THIS IS VERY IMPORTANT!!!)
    lcdout $FE, $39 'Function Set: 8 bits bus mode
    '//lcdout $FE, $29 'Function Set: 4 bits bus mode
    lcdout $FE, $1C 'Bias set
    lcdout $FE, $52 'Power control + Contrast (HiByte)
    lcdout $FE, $69 'Follower control
    Lcdout $FE, $74 'Contrast (LowByte)
    
    ' COG Optional settings
    'lcdout $FE, $38 'Function Set: switch back to instruction table 0
    'lcdout $FE, $0F 'Display ON/OFF
    'Lcdout $FE, $01 'Clear display
    'Lcdout $FE, $06 'Entry Mode Set: cursor auto-increment
    
    'lcdout $FE, $0F '%00001111 - Display ON, Cursor ON, Blink ON
    'lcdout $FE, $0C '%00001100 - Display ON, Cursor OFF, Blink OFF
    
    '-------------------------------------------------------------------------------
    ' Program
    MAIN:
    lcdout $FE, $70
    LCDOUT $FE,1,"2 Lines Display",$FE,$C0,"EA DOGM-162L-A"
    pause 1500
    LCDout $FE,1, "contrast = ", $FE,$C0,"Hello Gerben ;-)"
    For contrast = 0 to 15
        contrastcommand = $70 + contrast
        LCDout $FE, contrastcommand
        pause 10
        LCDout $FE,$8B, DEC2 contrast
        pause 200
    Next
    pause 1500
    
    goto main:
    end
    Roger

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 08:56
  2. need help in coding..
    By daphne8888 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 19th March 2008, 08:31
  3. Help GPS read with serin
    By leinske in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th September 2007, 03:33
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 16:04
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 13:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts