Exracting Stored Messages from Variable then Display them on LCD using LCDOUT Comman


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Red face Exracting Stored Messages from Variable then Display them on LCD using LCDOUT Comman

    Hi ,Everyone
    1. I wonder if its possible in PBP to Store Messages i.e "Charger Failure" ,"Low Fuel Level" e.t.c
    I've realised that LCDOUT command are Code Intensive,and each time I use just one command it uses alot of Program Space ,so I want to store the Display Messages elsewhere may be in EEPROM or a Table or ARRAY ,Then create a Sub-Program that will use the LCDOUT Command ,but instead of writing
    LCDOUT $FE,1, "Charger Failure" to Display the word Charger Failure on the Screen,I write it as below
    LCDOUT $FE,1, [Suitable Modifier] B0
    Assuming the Word Charge Failure was stored in a Variable B0

    2.If my suggestion above is possible ,please help me with the following

    a)What type of Variable should I use to Store such Statement
    Should I use BYTE or LONG ?
    b)What is the Snyntax for Assigning Such data to Variable
    I guess it cant be B0 = Charger Failure
    SO how should I go about This
    c)What Modifier should preceed the variable in the LCDOUT command in order to bring out the required result ?

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


    Did you find this post helpful? Yes | No

    Default Re: Exracting Stored Messages from Variable then Display them on LCD using LCDOUT Co

    Hi,
    You're comparing two different things.

    When you do LCDOUT FE,1,"Charger Failure" the string Charger Failure is stored in program memory when you program the chip and can not be changed.

    What you then describe is a string/array which is held in RAM and assigned its "value" or text/characters in this case by writing Charger Failure to it at runtime. This means that in order to write the string to the array at runtime it has to be stored somewhere.... Such a thing can be acihieved by using an array of bytes and then use ArrayWrite to "write" to the array, exactly as LCDOUT does:
    Code:
    MyString VAR BYTE[32]
    ArrayWrite, MyString, ["Charger Failure"]
    This however won't save you any much codespace (if any) and will consume more RAM than using LCDOUT directly.

    You can store strings/characters in on chip EEPROM with the DATA statment, that will write it to EEPROM when you program the chip and you can read it with the READ command in a FOR-NEXT loop and output the text, on character at a time, to the LCD. The amount of on chip EEPROM is usually quite small though.

    There have also been a couple of good discussions on how to store and retrieve strings in codespace which a bit of searching on the forum will turn up. It's not as straight forward as using LCDOUT directly but it WILL save some (or a lot) codespace if you're doing a lot of textmessages. See Darrels code here for example.

    Finally, the STR modifier is used to output the content of an array using LCDOUT etc but I since arrays, as described above, are stored in RAM, I don't think that is what you really want.

    /Henrik.

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