LCDOUT with 16f684


Closed Thread
Results 1 to 18 of 18
  1. #1
    rastan's Avatar
    rastan Guest

    Default LCDOUT with 16f684

    Hi, got a problem with my LCD display. it doesnt work and i think the reason why is because i need to connect the data line D4-D7 to pins RA0-RA3. the problem is that RA3 is either MCLRE or a digital INPUT.

    therefore i cannot have an output on that pin and i cant see a way to change the data out pins on the pic to anything but port a pins 0 to 3.

    also, this is the first time ive tried to use an LCD screen so what should it look like when it works. obviously there is no data going to the module, but i would have thought there would be some indication that the power is on, like a flash of the screen or something, but there was nothing. nothing changed.

    im using a powertip PC2004A - a 20 charater, 4 line module.
    pic 16f684 with internal rc no clock out, mclre disabled.
    connected it up like in the pbp manual. except the data lines.


    thanks guys
    phil

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


    Did you find this post helpful? Yes | No

    Post

    Hi Phil,

    If you're not planning on using the low half of PortC you could use that instead. You change it with a DEFINE, it's all in the manual. If you intended to use any of the hardwarefeatures on portC(low half) you're in trouble. The only option left is to change the assemblercode that makes up the instruction LCDOUT(and LCDIN if used). It can be done if you have the assemblerskills needed. You could perhaps use a different Pic, it all depends on what you want to do.

    Never used a powertip, can't help you with that.

    /Ingvar

  3. #3
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Red face thanks

    yeah thanks. cant believed i missed that. ill try it

    cheers
    phil

  4. #4
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Angry hmmmm

    well its still not working, ive tested the circuit with a 16f628A on proteus and it works, but i cant simulate a 684 and i dont have any other chips till they come in the post.

    im a bit worried about the actual lcd module, because there seems to be no life in it what so ever apart from the led backlight.

    is there any way to test it? like make all of the lcd's bits turn on so i can see if its not knackered?

    thanks

    phil

  5. #5
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default code

    by the way, this is the code for a 16f684

    ;LCD test Program

    ; Set LCD Data port
    DEFINE LCD_DREG PORTC
    ; Set starting Data BIT (0 OR 4) IF 4-BIT bus
    DEFINE LCD_DBIT 4
    ; Set LCD Register Select port
    DEFINE LCD_RSREG PORTC
    ; Set LCD Register Select BIT
    DEFINE LCD_RSBIT 0
    ; Set LCD Enable port
    DEFINE LCD_EREG PORTC
    ; Set LCD Enable BIT
    DEFINE LCD_EBIT 1
    ; Set LCD bus size (4 OR 8 bits)
    DEFINE LCD_BITS 4
    ; Set number of lines ON LCD
    DEFINE LCD_LINES 4
    ;
    DEFINE LCD_COMMANDUS 2000
    ; Set Data delay time in us
    DEFINE LCD_DATAUS 50


    TRISA = 0
    TRISC = 0

    cmcon0 = 7
    ansel = 0


    loop:
    Pause 1500
    LCDOut $FE,1,"Hello" ; Clear display AND show “Hello”
    LCDOut $FE,$C0,"World" ; Jump TO second line AND show “World”
    GoTo loop

  6. #6
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default and......

    sorry, one more thing, ive tested the pic with a scope and there are some sort of bits/commands coming out, so assuming the codes correct its working.

    Also, i put a current meter in the circuit and it only showed 1.62mA and the lcds datasheet that it normally takes about 2.5mA so its not getting powered properly.

    thats it. promise.

    phil

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


    Did you find this post helpful? Yes | No

    Default

    be sure your r/w pin (pin 5) on LCD is ground. Is when you're increase voltage on Vo (pin 3, kind of contrast) you see some black square block?

    by the way PORTC is only 6 bits.... so you must you this define


    ; Set starting Data BIT (0 OR 4) IF 4-BIT bus
    DEFINE LCD_DBIT 2 ;instead of 4

    but not sure if it's gonna work

    May use
    DEFINE LCD_DBIT 0



    do you use internal or external clock. In case you use internal clock you have to define OSCCON for proper clock mode.... factory is 32khz...really slow

    datasheet p31 (pdf)

    OSCCON=$60 ;set to internal 4MHZ clock

    that will work now!!!
    Last edited by mister_e; - 21st November 2004 at 22:38.
    Steve

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

  8. #8
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default

    ok thanks steve, r/w pin is on ground, modified code and circuit to give

    ;LCD test Program

    ; Set LCD Data port
    DEFINE LCD_DREG PORTC
    ; Set starting Data BIT (0 OR 4) IF 4-BIT bus
    DEFINE LCD_DBIT 0
    ; Set LCD Register Select port
    DEFINE LCD_RSREG PORTC
    ; Set LCD Register Select BIT
    DEFINE LCD_RSBIT 4
    ; Set LCD Enable port
    DEFINE LCD_EREG PORTC
    ; Set LCD Enable BIT
    DEFINE LCD_EBIT 5
    ; Set LCD bus size (4 OR 8 bits)
    DEFINE LCD_BITS 4
    ; Set number of lines ON LCD
    DEFINE LCD_LINES 4
    ;
    DEFINE LCD_COMMANDUS 2000
    ; Set Data delay time in us
    DEFINE LCD_DATAUS 50


    TRISA = 0
    TRISC = 0

    cmcon0 = 7
    ansel = 0


    loop:
    Pause 1500
    LCDOut $FE,1,"Hello" ; Clear display AND show “Hello”
    LCDOut $FE,$C0,"World" ; Jump TO second line AND show “World”
    GoTo loop


    also, i tested the contrast and got nothing. increased it to 9v. zilch

    do you think it is a knackered module???

    cheers

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


    Did you find this post helpful? Yes | No

    Default

    more sure it's because...

    do you use internal or external clock. In case you use internal clock you have to define OSCCON for proper clock mode.... factory is 32khz...really slow

    datasheet p31 (pdf)

    OSCCON=$60 ;set to internal 4MHZ clock

    maybe also an defect LCD... everything is possible.
    Steve

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

  10. #10
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default

    thanks mister_e, never thought of that, intrestingly though i put an extra bit of code in to flash an led for a split second and tested that with both the oscon in the code and without it. the led flashed at the same rate. are you sure that the default is 32kHz?

    as for the lcd working, it still doesnt so i think i might have to send it back.

    if anyones got anymore ideas then please say so.

    thanks everyone
    phil

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


    Did you find this post helpful? Yes | No

    Default

    what about if you're connecting all led to PORTC pins.

    and do

    OSCCON=$60

    start:
    PORTC=255
    pause 500
    PORTC=0
    pause 500
    goto start.


    are all the led flash???


    i'm sure you take care of connections of LCD but it happen to me one time to use BACKLITE pins instead of DATA pins... Are the other data pin left open or tied to ground. Some need to be connected to ground. Also try bigger delay at the beginning. Let's say 5 seconds.


    regards
    Steve

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

  12. #12
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default

    yup all the leds flash.
    double checked the led's led pins. ok.
    good idea with connecting d0-d3 to ground, still the same. doesnt work.

    phil

  13. #13
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default

    lcd's led. sorry

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


    Did you find this post helpful? Yes | No

    Default

    WEIRD... look to be defect LCD.

    what about if you use these line after PAUSE 2000 at the begining

    ;reinitialize Lcd before write on
    lcdout $fe,$28 ;lcd mode 4 bits,5x7, 2 lines
    lcdout $fe,$0c ;lcd on
    lcdout $fe,1 ;clear lcd


    but you put 9 volt to Vo pin... not sure is a good idea...


    can you add 10uF tantalum (47uF electrolytic) and a 0,1uF an the supply line close to the LCD ???
    Steve

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

  15. #15
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Angry

    nope. its gotta be a dead lcd.

    ill give it one more try when i get some 16f628A chips, and if that doesnt work then ill send it back.

    thanks mister_e

    phil

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


    Did you find this post helpful? Yes | No

    Default

    good idea ! let us know what's happenning with 16F628. But i don't think it will be different.

    regards
    Steve

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

  17. #17
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Cool LCD update

    Well just to let you know, i emailed the seller and it turns out that the only problem after all that was the voltage applied to the contrast pin Vop (or Vo in many cases). According to the appropriate powertip 2004A datasheet it states that this should be 4.2 - 4.8 volts. when i applied this i could not see it.
    when i applied 0.5 volts to it, bingo! it works fine.

    thanks a lot.
    phil

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


    Did you find this post helpful? Yes | No

    Default

    Usually for experimenting we place an trim pot on this pin... this is why i asked you what about if you vary the voltage on contrast pin...

    anyway, great to know everything's working good for you now!!!|

    regards
    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. 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