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
    891

    Default LCDOUT custom commands - how to?

    Hello,

    I just bought a LCD from ELECTRONIC ASSEMBLY http://www.lcd-module.de/deu/pdf/doma/dog-m.pdf. It is a ST7036 (HD44780 compatible) controlled display.

    After I made all required connexions, it doesn't work but I think I need to initialise the display since some settings like "Display ON/OFF" and "Contrast" are set by software (no cabling).

    I've got the initialisation codes in this table (see attachment) but... I don't really know how to use them.

    I declared all DEFINEs and wrote
    Code:
    LCDOUT $FE, $0F
    to switch the display on? Nothing happens - must be wrong.

    The "$FE" must be wrong. I found also the documentation about the controller that pilots this display here http://www.lcd-module.de/eng/pdf/zubehoer/st7036.pdf.

    It's surely not complicated, nevertheless I'm a little lost...
    Attached Images Attached Images  
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Nope, the first LCDOUT should take care of the initialisation. For safety sake use a 500mSec-1Sec at the top of your code before the first LCDOUT.

    LCDOUT $FE,1 just clear the display.

    Be sure you don't use your LCD on analog i/o AND/OR open drain type without using the right method (pull-up, set all I/Os to digital)

    As usual, your WHOLE code and PIC# will help.
    Steve

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

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Code

    I'm still not sure how to connect the datalines from the display to the PIC (is it DB0 = D7 and so on or is it DB0 = D4 and so on).

    Here is my code:
    Code:
    'PIC 16F88
    
    ' LCD circuitery
    '23,24,25,26,32,33,34,35,40 - Vdd (+5V)
    '27,38  - Vss (GND)
    '28 DB0 - PORTA.0
    '29 DB1 - PORTA.1
    '30 DB2 - PORTA.2
    '31 DB3 - PORTA.3
    '39 RS  - PORTA.4
    '36 E   - PORTA.6
    '37 R/W - PORTA.7
    
    
    DEFINE LCD_DREG PORTA       'LCD data port 
    DEFINE LCD_DBIT 4           'LCD data starting bit 0 or 4 
    DEFINE LCD_RSREG PORTA      'LCD register select port 
    DEFINE LCD_RSBIT 4          'LCD register select bit 
    DEFINE LCD_EREG PORTA       'LCD enable port 
    DEFINE LCD_EBIT 6           'LCD enable bit 
    DEFINE LCD_RWREG PORTA      'LCD read/write port
    DEFINE LCD_RWBIT 7          'LCD read/write bit
    DEFINE LCD_BITS 4           'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2          'Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000   'Command delay time in us 
    DEFINE LCD_DATAUS 50        'Data delay time in us
    
    
    ' Register settings
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    
    
    START:
        Lcdout $FE, 1           'Clear screen
    
    
    MAIN:
        pause 1000
        lcdout $FE, 2,   "This is line one"
        lcdout $FE, $C0, "This is line two"
        goto MAIN
    
    end
    Roger

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    This...

    '28 DB0 - PORTA.0
    '29 DB1 - PORTA.1
    '30 DB2 - PORTA.2
    '31 DB3 - PORTA.3

    is not compatible with this...

    DEFINE LCD_DREG PORTA 'LCD data port
    DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4

    ...and double-check with the Datasheet that you've disabled all Analogue Functions on PortA.

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


    Did you find this post helpful? Yes | No

    Default

    The display's datasheet makes me connect the lines D4 to DB3, D5 to DB2, D6 to DB1 and D7 to DB0 (see attachment "DB-Lines_connections.jpg"). This is why I thought the starting bit would be the fourth.

    I changed:
    Code:
    DEFINE LCD_DREG PORTA       'LCD data port 
    DEFINE LCD_DBIT 0           'LCD data starting bit 0 or 4
    and added:
    Code:
    ADCON0.0   = 0              'Disable Converter Module
    I went through the PIC's datasheet and couldn't find other settings that could affect the A ports. Still, the display looks just dead.

    I have two of them and react the same. I changed for my second 16F88 and the result is same too.
    Attached Images Attached Images  
    Roger

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Normally for a 4 bit bus

    DB0-DB3 = D4-D7

    Also if you are using a 16F88 check the ANSEL register
    Keith

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

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


    Did you find this post helpful? Yes | No

    Default Initialisation might be the key

    I'm reading the ST7036 driver's data sheet and I can't find where the operation voltage should be set.

    The difference I see between the 3.3V and 5V configuration are the "Voltage Booster" and "Voltage Follower". Okay, but what would be the settings?

    What is the "Bias" setting for?
    Roger

  8. #8
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    I'm reading the ST7036 driver's data sheet and I can't find where the operation voltage should be set.

    The difference I see between the 3.3V and 5V configuration are the "Voltage Booster" and "Voltage Follower". Okay, but what would be the settings?

    What is the "Bias" setting for?
    The registers where you can see the differences are where the values are set. The values you need are shown in Binary. just convert that to HEX and you have your commands eg Power command register for 5v working is shown as 0101 0010 which is $52 so

    LCDout $FE, $52 should do the trick.

    You mey not even need to convert it.... you may be able to send

    LCDout $FE, %01010010.

    I dont know the exact purpose of the Bias setting but as they give you the required values that is what you should use.
    Keith

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

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


    Did you find this post helpful? Yes | No

    Default let's wait infos from EA...

    Well,

    I got an answer from EA. They say they don't have any negative feedback about their displays. I shall send them my program and a picture (already done).

    I fully checked my PIC with LEDs and it's okay whithout any doubt.

    I have recabled the circuit with coloured wires to make it easy to see if I miss something obvious to you (see attachments).

    The code I will send to AE is this:
    Code:
    include "16F88-FUSES.BAS"
    
    'PIC 16F88 - 4MHz
    
    ' LCD circuitery
    '23,24,25,26,32,33,34,35,40 - Vdd (+5V)
    '27,38  - Vss (GND)
    '31 DB0 - PORTB.0
    '30 DB1 - PORTB.1
    '29 DB2 - PORTB.2
    '28 DB3 - PORTB.3
    '39 RS  - PORTB.4
    '36 E   - PORTB.5
    '37 R/W - Vss (GND)
    
    
    ' Wires from programmer (AN589)
    'Black = GND (Vss)
    'Red = +5V (Vdd)
    'Yellow = MCLR
    'Orange = Clock
    'Brown = Data
    
    
    DEFINE LCD_DREG PORTB       'LCD data port 
    DEFINE LCD_DBIT 0           'LCD data starting 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 5           'LCD enable bit 
    DEFINE LCD_BITS 4           'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2          'Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000   'Command delay time in us 
    DEFINE LCD_DATAUS 50        'Data delay time in us
    
    
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    CMCON      = %00000111      'Disable Comparators
    
    
    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
        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"
    
    LOOP: 
        Goto LOOP
    
    end
    Keithdoxey, thank you for your help to make me understand how to read the registers values. I'm okay now with this.

    Would I really have killed 2 displays???
    Attached Images Attached Images   
    Roger

  10. #10
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    Well,

    I got an answer from EA. They say they don't have any negative feedback about their displays. I shall send them my program and a picture (already done).

    I fully checked my PIC with LEDs and it's okay whithout any doubt.

    I have recabled the circuit with coloured wires to make it easy to see if I miss something obvious to you (see attachments).
    Thats much clearer
    Would I really have killed 2 displays???
    Hard to say. There is a line in the datasheet that says "Note that the COG technology means that the current capacity of the outputs is limited." It may also mean that COG technology is more susceptable to damage from static electricity.

    With a breadboarded circuit there is always a possiblility of accidental shorts and also open circuits. Some devices can be damaged if a voltage is applied to pins when the device itself is unpowered. A loose connection could cause that situation to arise.

    I somehow killed some pins on a PIC16F88 but to my knowledge I didnt do anything that was likely to have damaged it. Likewise I have also had solder bridges and other accidental shorts that you would expect to cause damage and things survive.

    Its one of the great mysteries !!!!
    Keith

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

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


    Did you find this post helpful? Yes | No

    Default Do you want a/d converters on?

    Unless you intend on A/D on:

    Code:
    DEFINE LCD_DREG PORTB       'LCD data port 
    DEFINE LCD_DBIT 0           'LCD data starting 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 5           'LCD enable bit 
    DEFINE LCD_BITS 4           'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2          'Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000   'Command delay time in us 
    DEFINE LCD_DATAUS 50        'Data delay time in us
    
    
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    <font color="red">ADCON1 = 7 ' or ADCON1 = %00000111</font> 'Disable A/D converter
    OPTION_REG = %01000000      'Enable PORTB pullups
    CMCON      = %00000111      'Disable Comparators
    
    
    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
        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"
    
    LOOP: 
        Goto LOOP
    
    end

  12. #12
    Nick82's Avatar
    Nick82 Guest


    Did you find this post helpful? Yes | No

    Default

    Hi there,
    I don't know what the status is...
    What I read was that you don't know how to connect the dataports to your display.
    I had the same trouble with another display.

    In 4-bit-mode many displays have to be connected via the upper databits.
    But NOT like it was posted:
    LCD PIC
    31 (D4) 9 (B3)
    30 (D5) 8 (B2)
    29 (D6) 7 (B1)
    28 (D7) 6 (B0)

    Try this solution (it worked in my case):

    LCD PIC
    D4 B0
    D5 B1
    D6 B2
    D7 B3


    Keep on PICing

  13. #13
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Let's try this!!!

    Hello Inse,

    Thanks a lot for your help.

    The initialisation sequence looks really weired but if it works...

    I'll go back to my breadboard and try this out.

    Thanks again :-)
    Roger

  14. #14
    Join Date
    Jul 2007
    Location
    Bavaria
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hello Roger,

    I could improve the intialization routine (at least optically)


    Pause 150 'wait for LCD to initialize

    LCDOut $29

    Low RS
    For a = 0 TO 7
    LookUp a, [2, 9, 6, 10, 2, 14, 1, 8], v
    Low EN
    PORTB = v*16
    High EN
    Pause 2
    Next a


    Does the same job but looks better.

    Regards, Ingo

  15. #15
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Some explanations needed

    Removed that post
    Last edited by flotulopex; - 22nd September 2007 at 22:57.

  16. #16
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Smile It works... in 8 bit mode

    Well,

    I made a try I didn't think about up to now: connect this display in 8 bit mode.

    Finally, it works and without any initialisation command.

    I'll try now to go backwards and find how to make it work in 4 bits mode.

    At least, I can make sure the display is not dead.
    Attached Files Attached Files
    Roger

Similar Threads

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

Members who have read this thread : 2

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