LCDout Command w/ LCD 4x40 display


Closed Thread
Results 1 to 26 of 26
  1. #1
    beto's Avatar
    beto Guest

    Default LCDout Command w/ LCD 4x40 display

    Hi!
    This lcd have 2 Enable lines (e1,e2), anyone know, how these lines to be handled by the pbp compiler?
    I buil this circuits but doesn't work ...
    Can helpme please? thanks ..... Friends
    code) look like this:


    DEFINE OSC 10
    DEFINE LCD_DREG PORTB
    DEFINE LCD_BIT 0
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 7
    DEFINE LCD_EREG PORTD
    DEFINE LCD_BITS 8
    DEFINE LCD_LINES 4
    DEFINE LCD_EBIT 6

    dsp var portd.5
    FLAGS = 0

    START:

    dsp = 0
    LCDOUT $FE,1 :PAUSE 500 : LCDOUT "SYSTEM 1" 'lcd upper

    dsp = 1
    LCDOUT $FE,1 :PAUSE 500 : LCDOUT "TWO SYSTEM" ' bottom lcd

    goto start
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    DEFINE OSC 10
    DEFINE LCD_DREG PORTB
    DEFINE LCD_BIT 0
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 7
    DEFINE LCD_EREG PORTD
    DEFINE LCD_BITS 8
    DEFINE LCD_LINES 4
    DEFINE LCD_EBIT 6

    dsp var portd.5
    FLAGS = 0

    START:

    dsp = 0
    LCDOUT $FE,1 :PAUSE 500 : LCDOUT "SYSTEM 1" 'lcd upper

    dsp = 1
    LCDOUT $FE,1 :PAUSE 500 : LCDOUT "TWO SYSTEM" ' bottom lcd

    goto start

    by this code, you're saying that you using the full 8bit for data... right???
    1. Be sure you don't revert D0 to D7.
    2. IMO you must define a LCD_LINES 2. This is why you have 2 enable lines... BUT I'M REALLY NOT SURE... i just see it's a 4X40 LCD...
    3. What about if you play with the voltage on Vo pin??? Is at least you see some black square???
    4. AND you didn't set direction of your dsp PIN... TRISD.5=0
    5. You may need a startup delay (about .5 to 2 sec) at the begining.
    6. Maybe DEFINE LCD_DATAUS and DEFINE LCD_COMMANDUS defines may do something.
    Last edited by mister_e; - 14th January 2005 at 16:21.
    Steve

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

  3. #3
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Angry

    I have tried to change the LCD_EBIT definition on "Fly"

    @#UNDEFINE LCD_EBIT
    @#DEFINE LCD_EBIT 6
    LCDOUT $FE,1 :PAUSE 500 : LCDOUT "SYSTEM 1" : PAUSE 2000

    @#UNDEFINE LCD_EBIT
    @#DEFINE LCD_EBIT 5
    LCDOUT $FE,1 :PAUSE 500 : LCDOUT "TWO SYSTEM": PAUSE 2000

    but it does not work either

  4. #4
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    Hi mister_e
    let me explain
    the code above works! but only in the first 2 lines of the lcd
    the problem is write data on botton lcd ,because I think that this
    LCD have two 2 x 40 display sharing only the data and rs/rw lines
    the other lines (e1 & e2) are for each part of LCD

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


    Did you find this post helpful? Yes | No

    Default

    O.k. So what about the TRISD.5=0 ?? Can you monitor ENABLE lines to see if they're adress separately?
    Last edited by mister_e; - 14th January 2005 at 16:25.
    Steve

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

  6. #6
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    I put long delay in the code and check with my logic probe to see changes
    and yes there are changes (using AND gates) but the lower part of lcd does not even work

  7. #7
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

  8. #8
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    thanks Ingvar:

    Its exactly tha same circuit (enable2.bmp)
    ... can be that I need high speed devices since that the pics runs at 10Mhz? , because only 1 lcd is working w/ that schematcs

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


    Did you find this post helpful? Yes | No

    Default

    No in this case, speed is not an issue. IMO, it's the *FLAGS* trick that you must place at the right place to initialize properly the LCD.

    OR the 2nd(bottom) lcd need specific addressing. What type of LCD are you using???
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    What about if you revert ENABLE lines? Is now bottom one is working but not the top one ???
    Steve

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

  11. #11
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Beto

    You should definitely try what Steve has suggested

    Originally posted by mister_e
    What about if you revert ENABLE lines? Is now bottom one is working but not the top one ???
    to make sure both the controllers on the module are working properly.

    I guess the only problem is the initialisation of the second controller.

    PBP sends the "INIT" String automatically with the first LCDOUT command issued.

    As with your Hardware design only one of the two controllers will be enabled at a time, only one controller will be initialised.

    The workaround is the to "RESET" Flags.

    So at the beginning of your program (before your MainLoop starts)
    you should add:

    PAUSE 500
    DSP=0
    LCDOUT $FE,1
    PAUSE 500
    FLAGS=0
    DSP=1
    LCDOUT $FE,1


    see my posting in the FAQ section Ingvar has already mentioned:

    Click here

    B.T.W.

    here is another useful link:

    Click here


    regards

    Ralph

  12. #12
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    The LCD is a Tianma TM404abcw6 model
    when I revert the ENABLE lines , what happens?
    the other part of the lcd respond, I mean;

    l-----------------------------------------l
    l 2 x40 lines upper part l < Controled by e1
    l-----------------------------------------l
    l-----------------------------------------l
    l 2 x40 lineslower part l< Controled by e2
    l-----------------------------------------l

  13. #13
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Beto,

    may we assume you have got it working now?

    regards

    Raplh

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


    Did you find this post helpful? Yes | No

    Default

    in case not can you try those lines...

    start:
    dsp=0
    lcdout $fe,$38 'lcd mode
    lcdout $fe,$0c 'lcd on
    lcdout $fe,1 'clear lcd
    lcdout "display 1"


    dsp=1
    lcdout $fe,$38 'lcd mode
    lcdout $fe,$0c 'lcd on
    lcdout $fe,1 'clear lcd
    lcdout "display 2"

    here: goto here
    Steve

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

  15. #15


    Did you find this post helpful? Yes | No

  16. #16
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    At least!
    A lot of thank friends...
    the problem was, I try to use the enable2.bmp circuit (posted here) but I do not use a real inverter, I mean; i build the inverter circuit (IC 1A) using a low profile NPN transistor (2N3904) as inverter (I have used before and worked very well ) I don't know why in this circuit doesn't work?
    the solution?... replace it with a 'real' inverter (i.e. 7404 Series)
    and presto Is working....
    Thanks Again

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


    Did you find this post helpful? Yes | No

    Default

    AHHHH damn

    What was your resistor value around your transistor ?!?
    Last edited by mister_e; - 19th January 2005 at 00:50.
    Steve

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

  18. #18
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    10k for the base bias and 1k for the colector (emitter tied to GND)

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


    Did you find this post helpful? Yes | No

    Default

    It have to work... in case not your 2n3904 don't have the great HFE... probably a die one :-)

    Have you try 1k for bias an 1k for the collector?
    Steve

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

  20. #20
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    Yes , Efectively changing to your values, the circuit works fine
    this 3904 do not have good AC Characteristics?

    With these val the base-emiter I is about 5mA and the 2N
    have a HFE about 70-100 (limiting Ic val to less of 10mA)

  21. #21


    Did you find this post helpful? Yes | No

    Default

    I don't understand anything about teh HFE and resistors,
    in my schematic i only use 2 resistors.

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


    Did you find this post helpful? Yes | No

    Default

    Well since we work in digital, common calculation is to multiply by ten the Base current needed.

    If 1K to the collector. Ic = 5/1000 = 5mA

    HFE = 70 (take the minimum to ensure...

    Ib= (Ic/HFE) * 10 = 0.7ma

    Rb = (5 - 0.7) / 0.7mA = 6k at minimum

    By the Maths, i figure that 5.6k, 5.1k or 4.7K as base resistor can also work.

    In many application you'll see 1k to base, 1k to collector too or same base value as collector one.
    Last edited by mister_e; - 20th January 2005 at 16:36.
    Steve

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

  23. #23


    Did you find this post helpful? Yes | No

    Default

    Oke that's what i understand, only are you guys realy using a transistor?

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


    Did you find this post helpful? Yes | No

    Default

    If you're not going to use the other inverter in this IC, why spend PCB space and $. Like the AND gate... if you have extra i/o, forget the AND gate and inverter stuff.
    Steve

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

  25. #25
    beto's Avatar
    beto Guest


    Did you find this post helpful? Yes | No

    Default

    MMhh.. Yes I have unused pic pins, How I can Integrate this circuit (and gate & inverter) in my program

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


    Did you find this post helpful? Yes | No

    Thumbs down

    oops forget about me... i'm wrong in that issue. There's probably some tricks to do but... at this time i can't see how to remove all of them...

    BTW you can save the inverter stuff using another enable i/o.

    PAUSE 500
    Enable1 = 1
    Enable2 = 0
    Lcdout $Fe,1,"I'm on the first one"
    pause 500
    FLAGS=0
    Enable1 = 0
    Enable2 = 1
    Lcdout $Fe,1,"I'm on the second one"

    This have to work and it's suppose to be easy to figure out how to connect to the PIC.
    Steve

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

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  2. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  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