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
    964


    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

  2. #2
    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.

  3. #3
    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

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Turn off comparators too

    Hi flotulopex,
    Ms Melanie mentioned to make sure all analog stuff is off, I saw no mention of the comparators. That silly 16F88 uses them. One of the harder early 16f series to set up because it uses ansel, adcon and cmcon registers and people seem to miss one or the other.
    CMCON=7
    JS

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


    Did you find this post helpful? Yes | No

    Default

    Darrel, i think you're right. My previous work on a regular 44780 controller type so far but will send
    3,0,3,0,3,0, and lastly 2,0... so 3 not really needed 0's...

    I did something else, but i don't think it will be handy now.

    NOW...
    Code:
        @  bsf LCD_EREG, LCD_EBIT
        PAUSEUS 20
        @  bcf LCD_EREG, LCD_EBIT
    yup, or
    Code:
        @  bsf LCD_EREG, LCD_EBIT
        @  PAUSEUS?C LCD_DATAUS
        @  bcf LCD_EREG, LCD_EBIT
    Joe S. The analog comparator are disable at POR on this one. But it's always nice to include the line too as safety sake.
    Last edited by mister_e; - 27th November 2006 at 08:00.
    Steve

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

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default

    It's so cruel: when I think all has been done, you All come with more suggestions and I'm in my office now and will have to wait until this evening to try all this out ;-)

    Okay Joe, I'll try this one. You're right, some settings on this PIC can be tricky if we forget them.

    Darrel, you're far ahead of what I'm able to understand. It sounds so clear for you. What shall I do, replace Mister_e's $30 by your $33?

    Merci Steve, it will be easy to copy/paste and check quickly.

    Come back to you later.

    Thank you All.
    Roger

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default LCDOUT xx, xx explanations needed PLEASE

    Until I can try all what you suggest, I would like to understand how you Guys read and interpret the codes in the Initialisation Table I put in my post #19. It looks so obvious to you, unfortunately it is not to me...

    As an example, I would like to know how you come to a LCDOUT $FE, $0C to switch On the display.

    In the table the line sais Display ON/OFF, you see the bits RS(I don't even know what this one is for) and R/W, and then you have for each DB7...0 a value (0 or 1). Finally you've got this $0F value which appears to me as coming from nowhere.

    I admit that the $FE is a standart value for sending datas to the display.

    But, in this example, where comes the $0C from? I'm lost...

    I'm missing this very basic stuff and bothering you with stupid questions so was this discussed in antoher thread already?
    Roger

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Das Book

    Quote Originally Posted by flotulopex

    But, in this example, where comes the $0C from? I'm lost...
    Hi flotulopex,
    No question you do not know the answer to is stupid.
    $0C - listed in PBASIC PRO MANUAL page 94. $0C = Cursor Off
    JS

  9. #9
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    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

  10. #10
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT custom commands - how to?

    Did you ever get the display to work in 4 bit mode?

  11. #11
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT custom commands - how to?

    I have my doubts with that circuit.

    With the 4 unused LCD data bits permanently tied high it’s impossible to initialise 4 bit mode,
    unless the LCD modules actually ignore the lower four bits value during initialisation.

  12. #12
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default 4 bits mode

    Quote Originally Posted by Fredrick View Post
    Did you ever get the display to work in 4 bit mode?
    All my circuits that use these LCDs are configured in 4 bits mode. Here is one example.

    If you're using one of these ELECTRONIC ASSEMBLY LCDs, the most important point is the initialisation sequence, especially, the 1 second PAUSE to settle the module.
    Code:
    ' DOGM LCD display Mandatory settings
    PAUSE 1000      'Time to settle Vdd (THIS IS VERY IMPORTANT!!!)
    LCDOUT $FE, $29 'Function Set: 4 bits bus mode
    LCDOUT $FE, $1C 'Bias set
    LCDOUT $FE, $55 'Power control + Contrast (HiByte)(for 5V=$52/3,3V=55)
    LCDOUT $FE, $6D 'Follower control  (5V=$69/3,3V=6D)
    LCDOUT $FE, $75 'Contrast (LowByte)
    Roger

  13. #13
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Thumbs up Re: LCDOUT custom commands - how to?

    Thank you flotulopex for this thread, now my 3x16 DOGM display works perfect.

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