LCDOUT custom commands - how to?


Closed Thread
Results 1 to 40 of 69

Hybrid View

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

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


    Did you find this post helpful? Yes | No

    Default but "how to" on my own?

    Hello Joe S.,

    I read this document (PBP manual) almost any time I have a question but I sometimes don't understand the explanations.

    As you mention, the actual $0C value listed in the manual switches the Cursor OFF; Mister_e sais that, according to the table, it switches the Display ON. There is a difference.

    Mister_e must have interpreted the table; this is what I would like to be able to do too.

    So, my question was more precisely to:
    a) understand the definition table (in post #19);
    b) learn how to use the informations on there.

    I don't know how to express myself more clearly but if my question looks confusing, please tell me.
    Roger

  3. #3
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    As you mention, the actual $0C value listed in the manual switches the Cursor OFF; Mister_e sais that, according to the table, it switches the Display ON. There is a difference.

    Mister_e must have interpreted the table; this is what I would like to be able to do too.

    So, my question was more precisely to:
    a) understand the definition table (in post #19);
    b) learn how to use the informations on there.
    Look at the datasheet for the LCD controller, specifically Page 26.

    "Display On/OFF"

    The 8 bits for the register = 00001DCB

    D= display 1=on 0=off
    C=cursor 1=on 0=off
    B=blink cursor 1=on 0=off

    so "00001100"

    Will give Display On Cursor and Blink off which is $0C

    $0C is the command to turn the Cursor OFF but it also turns the dsipay on as well

    $0E will turn the display on with a cursor
    Keith

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

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


    Did you find this post helpful? Yes | No

    Default

    So, the code looks like this now:
    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.6
    '37 R/W - PORTB.7
    
    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 6           'LCD enable bit 
    DEFINE LCD_RWREG PORTB      '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
    
    
    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"
    Pouet: 
        Goto Pouet
    
    end
    Guess what? The display still doesn't work.

    I'm waiting for AE to give some answers...

    At least, have a look at how the displays look like (they're only 2mm thick). Would be really nice if something could be written on it, no? (pin 21 is on the upper right corner looking at picture PICT0001small.JPG).

    Keithdoxey, it's getting clearer to me. I have to grab a piece of paper and study a little. Thanks a lot since this is exactly the kind of information I was looking for.
    Attached Images Attached Images   
    Last edited by flotulopex; - 27th November 2006 at 16:40.
    Roger

  5. #5
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    I use these to lines to make sure all the analog and comparator stuff is killed dead...

    ANSEL = %00000000 ' Disable Analogue Inputs
    CMCON = %00000111 ' Disable Comparators

    Looking at your photos it looks as if Pin37 of the LCD R/W is connected via a blue/green wire to pin 13 of the PIC RB7. There also seems to be an additional brown wire flying off somewhere from this pin. Where does the other end of that connect to ?

    Try with the R/W line connected directly to 0V as you only need to write to the PIC.

    One other point... I suggested putting LEDs on the PIC and observing it counting up to ensure that the count operated correctly. You said that you tested the pins with a logic probe, presumabley one pin at a time just to observe the two different states.

    The reason I suggested the LEDs is that when I first used a 16F88 I hadnt killed all the analogue bits properly and although I could turn an LED on on any pin, when I changed another pin the first LED would go out.

    The reason being that updating a pin involves reading the port register for the existing values, modifying it and writing it back. If any analogue stuff is still enabled the pin reads as a zero and will get set to zero even though it was previously a one.

    Do you have access to a "normal" HD44780 display of any size just to test that your PIC is correctly configured. From what I have seen so far there shouldt be any real problems getting this display to work as it is 44780 compatible. If you try with a normal display and it still doesnt work then something isnt right with the PIC. Once you have that working it should just be a matter of swapping the displays.
    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

    Looking at your photos it looks as if Pin37 of the LCD R/W is connected via a blue/green wire to pin 13 of the PIC RB7. There also seems to be an additional brown wire flying off somewhere from this pin. Where does the other end of that connect to ?
    It is the DATA wire (brown) coming from ICSP programmer (AN589). I've attached a "full view". Green LED on programmer is for power presence and yellow one (between both black relays) is for connection/disconnection of MCLR-DATA-CLOCK.

    Wires:
    black = GND (Vss)
    red = +5V (Vdd)
    yellow = MCLR
    orange = Clock
    brown = Data

    One other point... I suggested putting LEDs on the PIC and observing it counting up to ensure that the count operated correctly. You said that you tested the pins with a logic probe, presumabley one pin at a time just to observe the two different states.
    You're right. The LED you are talking about is there and as you suggest, I use it as an optical check. Do you mean I should connect more LEDs just to make sure it works fine?

    Do you have access to a "normal" HD44780 display of any size just to test that your PIC is correctly configured. From what I have seen so far there shouldt be any real problems getting this display to work as it is 44780 compatible. If you try with a normal display and it still doesnt work then something isnt right with the PIC. Once you have that working it should just be a matter of swapping the displays.
    Yes. As mentionned earlier, I made this check too and with my other displays (have lots of them), no problem!!
    Attached Images Attached Images  
    Last edited by flotulopex; - 27th November 2006 at 20:16.
    Roger

  7. #7
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    It is the DATA wire (brown) coming from ICSP programmer (AN589).

    Wires:
    black = GND (Vss)
    red = +5V (Vdd)
    yellow = MCLR
    orange = Clock
    brown = Data
    Ok. might be worth trying with R/W just connected to 0V.

    You're right. The LED you are talking about is there and as you suggest, I use it as an optical check. Do you mean I should connect more LEDs just to make sure it works fine?
    Yes. Put 8 leds on there and observe the count eg
    Code:
    OFF OFF OFF OFF OFF OFF OFF OFF (0)
    OFF OFF OFF OFF OFF OFF OFF ON  (1)
    OFF OFF OFF OFF OFF OFF ON  OFF (2)
    OFF OFF OFF OFF OFF OFF ON  ON  (3)
    OFF OFF OFF OFF OFF ON  OFF OFF (4)
    OFF OFF OFF OFF OFF ON  OFF ON (5)
    ......
    ON  ON  ON  ON  ON  ON  OFF OFF (252)
    ON  ON  ON  ON  ON  ON  OFF ON (253)
    ON  ON  ON  ON  ON  ON  ON  OFF (254)
    ON  ON  ON  ON  ON  ON  ON  ON (255)
    If the sequence doesnt work then the port isnt being correctly set

    Yes. As mentionned earlier, I made this check too and with my other displays (have lots of them), no problem!!
    Sorry, missed that.

    Good luck !!!!

    Keith
    Keith

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

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

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