LCD Display Formatting


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2015
    Posts
    2

    Default LCD Display Formatting

    Hi,

    I am a newbie to PBP3.0 and have studied the LCDOUT statement in the reference manual for some time without much enlightenment. (Examples in very short supply). Anyway, what I believe I want to do is to measure a voltage level with a ADC input, convert the output of the A/D to an actual voltage by scaling, store the result in memory, and then later read memory and insert this data into an LCDOUT statement as follows

    LCDOUT $FE, $80, B0,B1,".",B3,"VOLTS"

    Is this form of formatting OK?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: LCD Display Formatting

    Hi,
    That depends on HOW you scale the values and what's actually stored in B0, B1 and B2. As written the LCDOUT statement will send whatever is stored in B0 to the LCD meaning that if the B0 holds the value 65 you'll get the letter 'A' on the screen because the ASCII code for 'A' is 65. So, if you have ALREADY converted the value to ASCII and stored the first digit in B0 and the second in B1 then what you have is correct.

    What I suspect you want is something like
    Code:
    Voltage VAR WORD
    Voltage = ADResult */ 125   'Convert 0-1023 to 0-500 (roughly)
    LCDOUT $FE, $80, DEC Voltage / 100, "." DEC Voltage // 100
    /Henrik.

  3. #3
    Join Date
    May 2009
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: LCD Display Formatting

    Yes your formatting looks good.

  4. #4
    Join Date
    Oct 2015
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: LCD Display Formatting

    Hi Henrick,

    Yep, goes without saying that (a) the data stored would be in ASCII format and (b) I don't do stupid things like using B0,B1, etc instead of labels :-(. Geez, I am getting old................ As well as getting old, I'm getting lazy. Thank God for much early programming experience because the PBP manual ain't exactly forth coming :-)

    Thanks for coming back

    best regards
    Jim

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    That depends on HOW you scale the values and what's actually stored in B0, B1 and B2. As written the LCDOUT statement will send whatever is stored in B0 to the LCD meaning that if the B0 holds the value 65 you'll get the letter 'A' on the screen because the ASCII code for 'A' is 65. So, if you have ALREADY converted the value to ASCII and stored the first digit in B0 and the second in B1 then what you have is correct.

    What I suspect you want is something like
    Code:
    Voltage VAR WORD
    Voltage = ADResult */ 125   'Convert 0-1023 to 0-500 (roughly)
    LCDOUT $FE, $80, DEC Voltage / 100, "." DEC Voltage // 100
    /Henrik.

  5. #5
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: LCD Display Formatting

    Have you set up the circuit and tested any of your code?

    If not then that is what I would do...

    noting like the instant feedback of seeing the minor changes to your code and the effect on what is displayed on the LCD.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Similar Threads

  1. formatting #config question
    By tracecom in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd August 2013, 19:18
  2. Replies: 2
    Last Post: - 5th November 2009, 18:07
  3. glcd display vs lcd display
    By davids in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd July 2009, 19:16
  4. Replies: 3
    Last Post: - 30th June 2009, 23:06
  5. serial formatting
    By barkerben in forum General
    Replies: 4
    Last Post: - 7th January 2005, 18:54

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