LCDOUT custom commands - how to?


Closed Thread
Results 1 to 40 of 69

Hybrid View

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

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


    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

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

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


    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

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

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


    Did you find this post helpful? Yes | No

    Default

    ANSEL is set to have all analog ports disabled.

    As you suggested, I connected DB0 to D4 and so on...

    Still nothing happens.

    I'm just suprised that the display don't even flickers a little. It looks just like dead. Two displays doing the same makes me think I'm doing something wrong.

    Is is right to say that to make it work the Enable bit must be high? If yes, I could at least mesure it with my logic probe or oscillo....

    What can I "electrically" check else to minimise the cabling error risk?
    Roger

  7. #7
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Is there (or should there be) a contrast control that needs adjusting ?
    Keith

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

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


    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

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

  10. #10
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    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

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

  12. #12
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default Power supply decoupling

    One more thought.

    Add a 0.1uF capacitor across PIC 5 and PIC 14

    Add a 0.1uF capacitor across LCD 26/27

    Wont do any harm and if there is noise present on the supply it could clean it up.
    Keith

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

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

  14. #14
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default whithout A/D converters, capacitors added, ...

    ... still nothing on the display.

    May I ask what the "FLAGS=2" does?

    keithdoxey suggested that the breadboard could be a possible source of problems.

    I'll build the circuit up on another breadboard and I will see what happens.
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    PBP uses FLAGS.1 (LCDINITFLAG) to remember that it's already initialized the LCD. By setting it to 1, you can make PBP think it's already done, then you can go ahead and do the init manually.

    I don't think the Proto-Board itself would cause the display not to work. But I do agree with Keith in that somewhere along the line, something was probably wired wrong, then both displays were tried, and now both displays are most likely dead. It only takes a couple ms of reverse power to fry them.

    The reason I say that is because LCD's that haven't been initialized always show black squares on 1 line. From what I understand, you don't even get those.

    It may be time to cut your loses, and move on.
    DT

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 : 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