Shop OBEX P1 Docs P2 Docs Learn Events
DATA command — Parallax Forums

DATA command

ArchiverArchiver Posts: 46,084
edited 2004-04-25 15:59 in General Discussion
i have recently connected a 4x20 parallel LCD to my bs2, and found a
basic program to upload text. my understanding is that this program
writes the string i want to display to the eeprom of the stamp, and
then calls it back with the read command. my question is how to
change the DATA 'string' dynamically during program execution. any
help is appreciated

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-24 07:38
    --- In basicstamps@yahoogroups.com, "scomcleod" <scomcleod@y...>
    wrote:
    > i have recently connected a 4x20 parallel LCD to my bs2, and found
    a
    > basic program to upload text. my understanding is that this
    program
    > writes the string i want to display to the eeprom of the stamp, and
    > then calls it back with the read command. my question is how to
    > change the DATA 'string' dynamically during program execution. any
    > help is appreciated

    The way that I've handled this is to modify the LCD code so that it
    uses a variable which refers to a string to write. For example, here
    is a variable used by the LCD routine:

    lcdStr var word

    Then, define some strings this way:

    captions data " RPM HZ LOAD",0
    calStr data "Calibrating...",0
    manMode data "Manual Mode", 0

    and then display a particular one this way:

    lcdStr = calStr
    gosub outputStr

    The outputStr() subroutine should read bytes beginning at the
    location referred to by 'lcdStr' and display them, stopping when it
    gets to the zero byte at the end of the string. For example:

    outputStr:
    for i = 0 to 100
    read lcdStr + i, lcdData
    if (lcdData = 0) then outputStrDone
    gosub sendLCDData
    next
    outputStrDone:
    return

    The sendLCDData() subroutine should output the byte given
    by 'lcdData'.
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-25 15:54
    You can use WRITE to change a DATA table -- but you must know the
    location of your table (easy) and put some limit on its end so you don't
    overwrite any tables that follow. StampWorks experiment 31 will help a
    bit.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: scomcleod [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=AXT5k4lm5Bs-v19IeaBgePqo2ZXalQRs7dFygxb2ZnCotSjUpsRXL5co7kSS6RxYQ6IYgwi5LakMU7vCNA]scomcleod@y...[/url
    Sent: Friday, April 23, 2004 9:16 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] DATA command


    i have recently connected a 4x20 parallel LCD to my bs2, and found a
    basic program to upload text. my understanding is that this program
    writes the string i want to display to the eeprom of the stamp, and
    then calls it back with the read command. my question is how to
    change the DATA 'string' dynamically during program execution. any
    help is appreciated
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-25 15:59
    You can simplify your subroutine, especially with PBASIC 2.5:

    Output_Str:
    DO
    READ lcdStr, lcdData
    lcdStr = lcdStr + 1
    IF (lcdData= 0) THEN EXIT
    GOSUB Send_Lcd_Data
    LOOP
    RETURN

    Since "lcdStr" is a variable that gets modified by the program, there's
    no reason to use another variable to control loop that reads characters
    from the DATA table.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Don Kinzer [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=LQZsvsbVGAqekDPjc2J_HczLnUe1_bfMVuMtfHRr1NcVFh6qJwx2Seav4UAPfbnqqVgAv97Cp5-xWDHsMCBCDQ]dkinzer@e...[/url
    Sent: Saturday, April 24, 2004 1:39 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: DATA command


    --- In basicstamps@yahoogroups.com, "scomcleod" <scomcleod@y...>
    wrote:
    > i have recently connected a 4x20 parallel LCD to my bs2, and found
    a
    > basic program to upload text. my understanding is that this
    program
    > writes the string i want to display to the eeprom of the stamp, and
    > then calls it back with the read command. my question is how to
    > change the DATA 'string' dynamically during program execution. any
    > help is appreciated

    The way that I've handled this is to modify the LCD code so that it
    uses a variable which refers to a string to write. For example, here
    is a variable used by the LCD routine:

    lcdStr var word

    Then, define some strings this way:

    captions data " RPM HZ LOAD",0
    calStr data "Calibrating...",0
    manMode data "Manual Mode", 0

    and then display a particular one this way:

    lcdStr = calStr
    gosub outputStr

    The outputStr() subroutine should read bytes beginning at the
    location referred to by 'lcdStr' and display them, stopping when it
    gets to the zero byte at the end of the string. For example:

    outputStr:
    for i = 0 to 100
    read lcdStr + i, lcdData
    if (lcdData = 0) then outputStrDone
    gosub sendLCDData
    next
    outputStrDone:
    return

    The sendLCDData() subroutine should output the byte given
    by 'lcdData'.
Sign In or Register to comment.