Shop OBEX P1 Docs P2 Docs Learn Events
(multilingual) LCD Menu — Parallax Forums

(multilingual) LCD Menu

HerdyHerdy Posts: 6
edited 2008-06-15 19:56 in Propeller 1
Hi, I wonder if I might get some hints on building a (multilingual) menu send to a lcd. I am using the propeller chip with the SPIN language.
Basically I would like to be able to display a menu on a lcd screen, navigating through a tree structure, which is stored in a separate file a read by a SPIN program. I hoped to be able to read a XML file and read parent, sisters or child nodes, depending on the menu structure. It seems as if there was no support on reading this file format.

I tried to use multidimensional arrays declared in the DAT section, but that was not really easy for navigation from child to parent etc.

Has anyone build an (multilingual) lcd menu, where the values were stored in a separate file (e.g. text file or XML)?

Any hints are highly appresciated.

Herdy

Comments

  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-06-15 07:22
    Well, this might not be much help, but I am intrigued by your needs.

    I have built applicaitons with an LCD menu. I hadn't every considered the multilingual part, but it sounds like a neat problem to solve. If I was tackling this design need, then I would setup a frame work for a menu system and navigation. I would probably setup a fixed system, it sounds like your system may vary based on the the XML file, right? Once you have a fixed system you can then generalize it based on data read in from a file. Somewhere though you have to add limits because of memory - I think.

    Is the multilingual part build into the program or the XML file? In other words, lets say you have two languages. You could store the data in the program for both languages. If you want more languages, then storing in the XML file is best.

    How and where is the XML stored and read? There have been several threads and objects created for SD card access and similar. Maybe looking through some of those. I am not familiar enough with the XML format to say how easy it would be parse in SPIN or ASM, but I think it could be done.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter

    www.brilldea.com·- uOLED-IOC, RGB LEDs, TLC5940 driver PCB
    www.tdswieter.com
    One little spark of imagination is all it takes for an idea to explode
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-06-15 10:04
    hello herdy,

    what would be the maximum complexity of the menustructure ? How many submenues ? how many variaants of menues ?

    If this is for a single project or maybe only 3 or 4 per year. I estimate that the effort for developing a generaluse xml-file-parser
    is bigger than adjust menu-items per hand in simple textfiles.

    For small controls in the automobile-industry i used a simple system.
    The menues called lines from a simple textfile. Inside the textfile the lines had numbers

    showing the principle:

    Texfile
    001 Main-Menu
    002 Item1
    003 Item2


    and then a method
    writeLCDLine(1,1); 'reading the Txtfile line No 1 writing the content to line 1
    writeLCDLine(1,2); 'reading the Txtfile line No 2 writing the content to line 1
    writeLCDLine(3,127) ''reading the Txtfile line No 127 writing the content to line 3

    for more clarity and easy maintining you could define constants for the numbers
    and the names of the constants are selfexplaining

    An XML-File has overhead for nesting the data.
    Depending on the complextity of your menues it might be easier to use your own format

    Simulation on a PC could be done with a small VB, Delphi, Python or whatever language-program
    It has only to do read textline no show on simulated LCDisplay Pos X,Y

    best regards

    Stefan


    etc.

    The multilanguage functionality was done by changing the FileNAME
    one Textfile was named english.txt the other f.e. french.txt
    So the two file contained the same message under the same number
  • HerdyHerdy Posts: 6
    edited 2008-06-15 16:04
    StefanL38, Timothy
    Thank you guys for your hints. It seems, that SPIN has no easy access to XML. However XML was just a thought of accessing structurised data and display it on LCD.
    I would like to follow your suggestion (Stefan) using a statically linked text file and read out the line numbers.
    Do you have any code sample for the writeLCDline(LcdRow,sourceRow)?
    I wonder how you can access a linked text file by row number. What is to declare within the SPIN language. Do you use OBJ order DAT declarations? Which SPIN commands do you use to read the values (strings)?

    Herdy
  • StefanL38StefanL38 Posts: 2,292
    edited 2008-06-15 19:56
    Hello Herdy,

    i used this textfiles on a (Yes you read right) a DOS-based 486-System

    If you have only a few lines of text. It will fit into the EEPROM as DAT-Data and leave enough space for
    your program. Then i would make every message with a constant lenght that it is easy to calculate an offset.
    Of course this will waste memory. so this solution depends highly on the amount of text.
    Another idea is to use byte-arrays.

    For bigger textes i would take an SD-Card. There are several drivers in the object-exchange.
    Some drivers work up to 2GB. So this should be enough. I haven't used SD-cards yet. But i think
    the datatransferspeed of 300 kb/sec is big enough. Inside the file i would use a constant message-lenght
    (the lenght of one LCD-line) then it is easy to calculate the offset to locate a specific message
    on the SD-card.

    The offset will be (LineNumber - 1) x lengthOfLine + 1
    example using 2x1234567890
    first line 12345678901234567890
    second line starts with byte No 21
    third line with byte 41

    (3 - 1) * 20 + 1 = 41
    or you start with line 0 and byte 0 then it is simply LineNumber x lengthOfLine

    line one byteNo 0-19
    second line byteNo 20-39
    third line byteno 40-59

    third line has lineNo 2: 2 * 20 = 40

    If nobody has samplecodes it is easy to find the right calculation by try and error
    start with a textfile containing 4-5 lines. just containing
    First Line: StartLine1-Line1-Line1.....STOP where the "P" is in the last columm (20 or 40 depending on your display)
    second line StartLine2-Line2-Line2.....STOP etc.

    If it works for line 3 to 5 it works for all lines.

    So this could be a new thread that will be interesting to many users:
    title of the tread something like: methods to read strings from a SD-card

    there is an object "FAT16 routines with secure digital card layer" for this

    http://obex.parallax.com/objects/92/

    best regards

    Stefan
Sign In or Register to comment.