Dummy needs LCD tutorial,


Closed Thread
Results 1 to 33 of 33
  1. #1
    TK5EP's Avatar
    TK5EP Guest

    Default Dummy needs LCD tutorial,

    Hi All,

    I start with PICs and have some problems regarding LCD display.

    For a 628, i wrote some lines of code to read a frequency in PORTA.4 and display the result after applying a formula.
    The format of the displayed datas is like 0 km/h to 180 km/h

    When the data displayed is for ex. 120 km/h and the next one 10 km/h i have the remaining m/h of the first data still displayed , so i have 10 km/h h displayed.

    Do i have to clear the LCd before each display or format the data to have the same length to avoid this problem ?

    Also, if i want to display a small cursor ( like || ) that would move on the line like a bargraph, how can i create and display this ?

    Is there a tutorial about LCDs somewhere ? I didn't find it.

    Greetings from Corsica, Patrick.

  2. #2
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TK5EP
    When the data displayed is for ex. 120 km/h and the next one 10 km/h .
    Good brakes or wall?

    If you clear the LCD you will have a flickering LCD.

    For the bargraph just print the ASCII value 255 on the second line of the LCD.
    Will be like that █ █ █ █ █ █.



    Luciano

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


    Did you find this post helpful? Yes | No

    Default

    When displaying your km/h data, suffix it with one or two ASCII spaces ($20 Decimal 32). This will overwrite any characters remaining from the end of the prvious display.

    It's neater to RIGHT JUSTIFY numeric displays, this saves the km/h waving about along the right-hand side of the numeric value which becomes a distraction... this probably will look a lot more professional...

    Code:
    LCDOUT $FE,$80
    If kmh<100 then LCDOUT " "
    If kmh<10 then LCDOUT " "
    LCDOUT #kmh," km/h" ' note no trailing spaces required
    rather than this, which despite being simpler code, ends up looking tatty...
    Code:
    LCDOUT $FE,$80,#kmh," km/h  " ' note the couple of trailing spaces here

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Smile Corsicaaaaaaa de mes amours ....

    Hi, Patrick

    I Committed something about bargraphs, some years ago, I do not know where it was coming from ( Parallax, may be ...)

    Here is a listing to show ...

    Alain
    Attached Files Attached Files
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Formating

    Hi Melanie and Luciano,

    Nor good brakes or wall, simply wanting to display wind speed coming from an anemometer.
    I understand that i have to format the data so it overwrites the previous one.
    Melanie, no difference in your code if kmh<100 or kmh<10 ?

    What about displaying a moving cursor about half the wide of a full black character (ASCII 255 as you mentionend)

    I want to display the wind speed in full character in km/h and/or a sliding narrow cursor one the second line under a scale on the 1st one.

    Melanie, is there a tutorial or an good explanation about the LCD display ?

    Thanks for your help.
    Last edited by TK5EP; - 28th September 2005 at 12:40.

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


    Did you find this post helpful? Yes | No

    Default

    No tutorial - just program, play and learn from doing.

    Assuming you'll never exceed 255 km/h wind speed (byte variable) and you don't live in Louisianna...

    My example right-justified... so the maximum you can display is three characters (100-255 km/h).

    If your spped is less than 100 km/h, then you prefix with one blank... this covers 10-99 km/h.

    If your speed is less than 10km/h, then you need to prefix with two blanks (0-9 km/h).

    Using this method, you get a stationary "km/h" label with the digits moving to the left. A lot neater than digits moving to the right with the "km/h" label flapping about behind them.

  7. #7
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Tréport, trop foooort !

    Merci Alain

    I'm starting with PICs and it's my first project. I have some good experience in BASIC but have to adapt my knowledges to Picbasic.

    I use a demo version (PROTON lite) but i'm thinking to change to Melabs, the forum and support seems to be much better !
    Unfortunately, the Melabs demo allows only 35 lines... and the registered version is a bit expensive for an occasional project !
    With 35 lines you have to be a bit tricky....

    Greetings from sunny Corsica,

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


    Did you find this post helpful? Yes | No

    Default

    > the (MeLabs) forum and support seems to be much better

    Now why do you say that? Just curiosity (though it did bring a smile when I read that). At a glance, they have ten-times the amount of activity that this forum has for roughly the same number of members...

  9. #9
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Ok

    Well, in Louisinia my anemometer would be broken. It's limited to 180 km/h !

    OK, i understand it now. My 2nd question was because i saw no difference between both lines, i think you forgot a space between " " in the line for kmh<10. Do i have it right ?

    Thanks for your help, appreciated it.
    Patrick.

    Quote Originally Posted by Melanie
    No tutorial - just program, play and learn from doing.

    Assuming you'll never exceed 255 km/h wind speed (byte variable) and you don't live in Louisianna...

    My example right-justified... so the maximum you can display is three characters (100-255 km/h).

    If your spped is less than 100 km/h, then you prefix with one blank... this covers 10-99 km/h.

    If your speed is less than 10km/h, then you need to prefix with two blanks (0-9 km/h).

    Using this method, you get a stationary "km/h" label with the digits moving to the left. A lot neater than digits moving to the right with the "km/h" label flapping about behind them.

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink Cooorsicaaaaaaa ....

    I just forgot it was written for a 16F84 ...

    But, in Mel's answer, I didn't see something like :

    LCDOUT $FE, $80, ... to place cursor at the beginning of the 1st line, to be sure to overwrite old text ...



    Alain

    PS: si ça t'intéresse, j'ai les typons pour une petite plaque de démo Kivabien avec un buzzer, trois Leds, 3 E/S , un cavalier de reset ou config et un afficheur LED 2x16...

    ça aide ...beaucoup !!!
    Last edited by Acetronics2; - 28th September 2005 at 14:11.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    > think you forgot a space between " " in the line for kmh<10. Do i have it right ?

    Partially. My example is however correct.

    The first IF statement adds one blank (space).
    The second IF statement adds one blank.

    If the value is < 10 km/h, then BOTH 'if' statements will be excuted adding a total of two blanks. If the value is > 9 and < 100, then only the FIRST 'if' statement is excuted adding only one blank.

  12. #12
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Forum

    Well, i got an answer quickly on this one, and found more infos in the archives for my level than on the other one.
    I saw more posts here since one week i'm interested in PICs.

    Maybe a bad guess ? But keep smiling !



    Quote Originally Posted by Melanie
    > the (MeLabs) forum and support seems to be much better

    Now why do you say that? Just curiosity (though it did bring a smile when I read that). At a glance, they have ten-times the amount of activity that this forum has for roughly the same number of members...

  13. #13
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    * * *
    Custom Characters tutorial:
    http://www.parallax.com/dl/docs/cols...1/col/nv32.pdf

    LCD Character Generator: (Freeware)
    http://www.parallax.com/dl/sw/lcdcc.zip

    * * *

    Writing custom characters to LCD display:
    http://www.picbasic.co.uk/forum/showthread.php?t=242


    Luciano

  14. #14
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default ;-)

    Oupssss !
    Next time, i will turn my keyboard 7 times before writing a post !
    Sorry... :-(

    Quote Originally Posted by Melanie
    > think you forgot a space between " " in the line for kmh<10. Do i have it right ?

    Partially. My example is however correct.

    The first IF statement adds one blank (space).
    The second IF statement adds one blank.

    If the value is < 10 km/h, then BOTH 'if' statements will be excuted adding a total of two blanks. If the value is > 9 and < 100, then only the FIRST 'if' statement is excuted adding only one blank.
    Last edited by TK5EP; - 28th September 2005 at 14:28.

  15. #15


    Did you find this post helpful? Yes | No

    Default

    For a bar graph go to http://www.picbasic.co.uk/forum/show...LCDbar_INC.bas. Darrel wrote an include file that dones an amazing job using a bar graph.

  16. #16
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Talking Bingo !

    Ciao Luciano,

    Grazie mille !

    That was exactly what i was looking for !
    This forum seems to be the right place for me... ;-)

    Thanks a million to all of you for your kindness.

    Quote Originally Posted by Luciano
    * * *
    Custom Characters tutorial:
    http://www.parallax.com/dl/docs/cols...1/col/nv32.pdf

    LCD Character Generator: (Freeware)
    http://www.parallax.com/dl/sw/lcdcc.zip

    * * *

    Writing custom characters to LCD display:
    http://www.picbasic.co.uk/forum/showthread.php?t=242


    Luciano

  17. #17


    Did you find this post helpful? Yes | No

    Default

    Hi Darrell,

    I love the bar graph display. Can it be set up to do the following:

    1. A text line showing the current temperature in deg C with 0.1 deg resolution. (Temperature data from a thermistor via a PIC a/d data channel.)

    2. Several bar graph lines showing (a.) the current temp. and (b.) the temp. as recorded in the preceeding 30 second intervals; with as many bars as is practical.

    3. As a new data bar is entered the oldest bar drops off.

    Possible?
    Last edited by Dick Ivers; - 29th September 2005 at 00:00.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    > the (MeLabs) forum and support seems to be much better

    Now why do you say that? Just curiosity (though it did bring a smile when I read that). At a glance, they have ten-times the amount of activity that this forum has for roughly the same number of members...
    Me as well had a smile on my face...


    I don't want to start yet another "heated debate",
    but to be fair,
    I'm sure if Patrick had provided a bit more of information about his Project on "the other" Forum
    he would have got some better response.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



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


    Did you find this post helpful? Yes | No

    Default

    you can't imagine MY smile... period!
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dick Ivers
    Hi Darrell,

    I love the bar graph display. Can it be set up to do the following:

    1. A text line showing the current temperature in deg C with 0.1 deg resolution. (Temperature data from a thermistor via a PIC a/d data channel.)

    2. Several bar graph lines showing (a.) the current temp. and (b.) the temp. as recorded in the preceeding 30 second intervals; with as many bars as is practical.

    3. As a new data bar is entered the oldest bar drops off.

    Possible?
    Absolutely Possible!

    You can have as many bars as you can fit on the screen. They can come and go anytime you please.

    Just remember that when you're finished with 1 particular BAR, call the BARgraph macro 1 more time with a 0 value, to clear the area that it used. It's more efficient than clearing the screen, and re-drawing everthing else. Looks better without the flicker too .
    <br>
    Glad you like it! Thanks!
    DT

  21. #21
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Sorry !

    Sorry if i bothered someone, it was not my intention... :-(
    My apologies if i did !
    Some of you are on both forums and answered me on both.

    Anyway, i will survey both forums and post on both. ANY help is welcome.

    Patrick,

    Quote Originally Posted by NavMicroSystems
    Me as well had a smile on my face...
    I don't want to start yet another "heated debate",
    but to be fair,
    I'm sure if Patrick had provided a bit more of information about his Project on "the other" Forum
    he would have got some better response.

  22. #22
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Porting Bargraph include to other Picbasic.

    Hi Darrell,

    I too like your include and already posted a question about it, but did not get any answer.

    I would like to use it with another Picbasic.

    In one line you have : Remainder = R2

    What is this R2 ?

    Do you know if your file has been ported to other versions of Picbasic ?

    Thanks,

    Quote Originally Posted by Darrel Taylor
    Absolutely Possible!

    You can have as many bars as you can fit on the screen. They can come and go anytime you please.

    Just remember that when you're finished with 1 particular BAR, call the BARgraph macro 1 more time with a 0 value, to clear the area that it used. It's more efficient than clearing the screen, and re-drawing everthing else. Looks better without the flicker too .
    <br>
    Glad you like it! Thanks!

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


    Did you find this post helpful? Yes | No

    Default

    You see, there are reasons why you should be using the MeLabs compiler... Darrel's magic code is one of them...

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TK5EP
    Sorry if i bothered someone, it was not my intention... :-(
    Oh no you didn't. You just raise an interesting fact wich make some people here laugh and some other cry. No harm at all.

    Quote Originally Posted by Melanie
    You see, there are reasons why you should be using the MeLabs compiler... Darrel's magic code is one of them...
    only one of them
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    already posted a question about it, but did not get any answer
    Sorry about that! &nbsp; I was purposely ignoring it.

    Some other guy came in here and said that "The Other compiler" did everything that PicBasic Pro didn't. &nbsp; So, I didn't think you needed it.

    "I picked a bad day to stop sniffing glue" - Airplane.

    But seriously folks, &nbsp;R2 is a PicBasic Pro system variable that holds the modulas remainder after a 31x15 divide with the DIV32 command. &nbsp;I don't use "The Other compiler", so I really don't know how you would do that.
    <br>
    DT

  26. #26
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default Different way to store CGRAM ?

    Hi again !

    I found a small example of a bargraph that i can make working with the demo version. I can't include Darrel's include...

    It works OK, and i could modifiy it to my needs, i understood almost all the code except the method used to store in the CGRAM :
    Lcdout $FE,64,0,0,0,0,0,0,0,0 ' blank
    Lcdout $0,$10,$10,$10,$10,$10,$10,$0 ' |
    Lcdout $0,$14,$14,$14,$14,$14,$14,$0 ' ||
    Lcdout $0,$15,$15,$15,$15,$15,$15,$0 ' |||

    Following the different other codes i've found, i would have done it this way :
    lcdout $FE,$40,$00,$00,$00,$00,$00,$00,$00,$00
    lcdout $FE,$48,$10,$10,$10,$10,$10,$10,$10,$00
    lcdout $FE,$50,$14,$14,$14,$14,$14,$14,$14,$00
    lcdout $FE,$58,$15,$15,$15,$15,$15,$15,$15,$00

    or for last line lcdout $FE,$58,REP $15\7,$00

    How is the 1st method working ??

    BTW what does LCDOUT $FE,$CE make ?

    also LCDOUT $FE,$80+1 would move the cursor to first line second character ?

    FYI, i changed from the "other" compiler to MELabs one.... ;-)

    Greetings,

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


    Did you find this post helpful? Yes | No

    Default

    CGRAM is just a 64 byte contiguous block of RAM. Once you set the address to write to, you can just continue sending bytes untill your done, or you reach the end of RAM. So, your first group of LCDOUT's will set 4 custom chars, starting at location 0.

    The second group accomplishes the same thing, but also sends the address for the character each time. As long as your not going to be changing things, the first group uses less code and execution time, but the second group is easier to cut&paste into other programs, since the address goes with it. &nbsp; "6 of 1, half dozen of the other".

    $FE,$CE will move the cursor to the 15th character on the second line.

    and, correct on the $FE,$80+1
    <br>
    Last edited by Darrel Taylor; - 1st October 2005 at 05:59.
    DT

  28. #28
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    I'm working on a project right now that is displaying a similar LCD display. I have a bargraph for the bottom of the display and text values for the top.

    I used the following basic stamp project as a template to start from.

    http://www.parallax.com/html_pages/r...PM_display.asp

    With PBP you don't have to mess around with all the nibbles that are in this problem. Also you will need to alter some of the variables. In the end I stripped out all the subroutines that write to the display and just used LCDout. Works great! It took a little bit to understand some of the math but once you have that it makes compelete sense and works well.

  29. #29
    TK5EP's Avatar
    TK5EP Guest


    Did you find this post helpful? Yes | No

    Default All display problem solved, but ...

    Hi all,

    And thanks for all the infos. Now i've understood most problems and i can display almost all what i want and it will be enough for my project.
    I have to measure currents and voltages that are moving rapidly, they follow the voice shape.
    I used the code sent here in this post by Acetronics. I removed all what i did not need and it works perfectly.

    As the display is moving fast, it would be nice if i could display a "holding bar" for a few moments at the peak value.

    What is the best way to store the peak value in a variable ?
    Maybe somebody has already made a similar code ?

    For the moment i did not use an analog input, i randomly generate the values.

    Greetings,

  30. #30
    crocodilebobbie's Avatar
    crocodilebobbie Guest


    Did you find this post helpful? Yes | No

    Default LCD display

    Hi:

    I usually find a format for the LCD data which does not change and display that information formated prior to the "loop". That way the display does not flicker. The data that does display is collected and displayed inside the loop, and using pause command to slow down changes.

    does that make sense?

    bobbie

  31. #31
    Join Date
    Jun 2009
    Posts
    8


    Did you find this post helpful? Yes | No

    Red face Graphic lcd 128*64

    Hello, i need informations i want to use GRAPHIC LCD 128*64 with bar graphs etc but i dont know how i have the pic basic pro compiler and i want to know if i use lcdout it is not compatible for glcd....
    whitch are the defines???
    simple code???

  32. #32
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by davids View Post
    Hello, i need informations i want to use GRAPHIC LCD 128*64 with bar graphs etc but i dont know how i have the pic basic pro compiler and i want to know if i use lcdout it is not compatible for glcd....
    whitch are the defines???
    simple code???
    I think you didn't understand there's NO support, for the day, for GLCDs with PicBasic Pro ...

    May be ... another Basiç ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  33. #33
    Join Date
    Jul 2005
    Location
    Palmdale, CA
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Dummy needs LCD tutorial,

    Quote Originally Posted by Melanie View Post
    When displaying your km/h data, suffix it with one or two ASCII spaces ($20 Decimal 32). This will overwrite any characters remaining from the end of the prvious display.

    It's neater to RIGHT JUSTIFY numeric displays, this saves the km/h waving about along the right-hand side of the numeric value which becomes a distraction... this probably will look a lot more professional...

    Code:
    LCDOUT $FE,$80
    If kmh<100 then LCDOUT " "
    If kmh<10 then LCDOUT " "
    LCDOUT #kmh," km/h" ' note no trailing spaces required
    rather than this, which despite being simpler code, ends up looking tatty...
    Code:
    LCDOUT $FE,$80,#kmh," km/h  " ' note the couple of trailing spaces here

    I know this is an old post... But when I try to enter an lcdout statement with a pair of quotes, I get an error saying empty string not allowed. Oh hell, I think I answered my own question. It's because I forgot the space between the quotes... Right?

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. LCD Problem
    By karenhornby in forum General
    Replies: 3
    Last Post: - 19th June 2008, 11:43
  4. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

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