16f687 - Where is the data stored?


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: 16f687 - Where is the data stored?

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    Here the strings are stored in program flash (where else should it go?) and written to the LCD when the LCDOUT statement executes. It's not the most efficient way of doing it but it's probably the easiest. If the messages are partly "the same" (like in the above example) you can have subroutines to print just that part which you then GOSUB from within the Case section, that will save on flash since you don't have to store the same string ("This is message") more than one time[code]
    /Henrik.
    Love the idea, unfortunately, the messages are ALL different. Some have similar parts, but not similar enough to make that viable.

    That's the reason for LOTS of messages.

    I decided to store 16 characters for each message (including leading and trailing spaces) because it makes displaying them SO much easier. Each one is a complete line on the LCD, and the loop is the same, no matter if the message is " BLACK FLAG "
    or " REPORT TO PIT ". I want each message centered in the display for ease of reading at race speeds.

    Ciao!

    Andy

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default Re: 16f687 - Where is the data stored?

    Storing spaces is extremely inefficient. Create a routine that pads the message with the appropriate number of leading/trailing spaces before sending it out to the LCD.
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

  3. #3
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: 16f687 - Where is the data stored?

    Quote Originally Posted by rmteo View Post
    Storing spaces is extremely inefficient. Create a routine that pads the message with the appropriate number of leading/trailing spaces before sending it out to the LCD.
    I suppose I could store each message without spaces, then write a unique "stop character".

    Then I could just count the characters to the stop character, then calculate the number of spaces needed to pad it to the center of a 16 character line.

    The only thing is accessing the right message. I intended to send the message number as part of the data block. I was going to calculate the start address of the message from the message number, and retrieve 16 characters. I guess I could just send the start address as the message number, then retrieve characters until I encounter the stop character. That would work, and is WAY more efficient (in both memory space and processor cycles).

    Thanks!

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: 16f687 - Where is the data stored?

    Why not clear the screen, move the cursor to the first position, print the message?
    Code:
    CursorPos VAR BYTE          ' 0=first line first char, 64=second line first char (I think, usally...)
    
    CursorPos = 1
    GOSUB Clear_and_set_cursor
    LCDOUT "Report to pit"
    
    Pause 2000
    
    CursorPos = 5
    GOSUB Clear_and_set_cursor
    LCDOUT "STOP"
    
    ' and so on
    
    END
    
    Clear_and_set_cursor:
       LCDOUT $FE, 1, $FE, ($80 + cursorposition)
       RETURN
    /Henrik.

  5. #5
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: 16f687 - Where is the data stored?

    Quote Originally Posted by HenrikOlsson View Post
    Why not clear the screen, move the cursor to the first position, print the message?
    /Henrik.
    Exactly what I plan on doing. Since each line is usually somewhat less than 16 characters, though, I want to have some leading spaces to bring each line to the center of the display. I'll just calculate how many characters less than 16 a line is, then divide that by two and use that as my pad in the front.

    I just figure having it centered makes it easier for the driver to read when he's going fast a trying to avoid someone else.

  6. #6
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: 16f687 - Where is the data stored?

    Quote Originally Posted by rmteo View Post
    Storing spaces is extremely inefficient. Create a routine that pads the message with the appropriate number of leading/trailing spaces before sending it out to the LCD.
    Of course, shipping product with unused memory is pretty inefficient too. If there's plenty of unused program store, why waste time improving efficiency, particularly for a code block that isn't very reusable?
    To paraphrase old movies, "smoke 'em if you've got 'em, lads." But if things are tight, I agree completely.

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