How to write/read strings EEPROM/LCD


Results 1 to 23 of 23

Threaded View

  1. #1
    Join Date
    Dec 2005
    Posts
    46

    Default How to write/read strings EEPROM/LCD

    Hello,
    Im using a 16F648A and my program has a bunch of LCDOUT commands so that the user can select different settings. Well, I am adding new features, and am out of space. I saw Melanies post "Making Program Code Space your playground" for program space, but this chip won't allow that, so I'm thinking EEPROM is the Solution?

    Here's part of the code I cut out to give a better idea of what I'm doing. Each time a certain button is pushed, it loops back through this part of the code:

    Case 2
    Refresh = Refresh + 1
    IF Refresh = 9 Then Refresh = 1
    ref:
    Select Case Refresh
    GoSub lcdone ' Position cursor at home
    LCDOut "Refresh"
    GoSub lcdsec
    Case 1
    LCDOut "None"
    RefTime = 0
    Case 2
    LCDOut "30 Sec"
    RefTime = 30 ' Move to 2nd line on LCD
    Case 3
    LCDOut "2.5 Min"
    RefTime = 140
    Case 4
    LCDOut "7 Min"
    RefTime = 400
    Case 5
    LCDOut "15 Min"
    RefTime = 900
    Case 6
    LCDOut "30 Min"
    RefTime = 1700
    Case 7
    LCDOut "1 Hour"
    RefTime = 3500
    Case 8
    LCDOut "2 Hour"
    RefTime = 7000

    End Select
    Pause 400

    I have several of these menus throughout the program and the strings for most LCDOUT commands are different. I have played a little with EEPROM, but am not sure the easiest way to us it. Here's the only thing that I've gotten to work, but I'm afraid in may take more space (and a ton of work). I'm using values 0-15 for other stuff, so "A" is at 16. The code below displays "BAD" on the LCD.

    EEPROM 0, [1,1,10,0,0,0,24,1,1,150,0,250,0,1,1,0,"A","B","C", "D","E","F","G","H","I","J","K","L","M"]

    testmem VAR BYTE[8]

    Read 17, testmem[0]
    Read 16, testmem[1]
    Read 19, testmem[2]
    testmem[3] = " "
    testmem[4] = " "
    testmem[5] = " "
    testmem[6] = " "
    testmem[7] = " "

    LCDOut STR testmem

    I had to add all of the blank spaces in the last 5 spots of the array to keep "wierd" characters from being displayed. In the manual where it talks about strings in EEPROM, it says "No lenghth or terminator is automatically added", so I assume that's the reaon for the wierch characters, but don't really know how to fix it. I'm using the array of 8 since the LCD is a 2x8 display. Anyway, am I wasting my time here? Would I be better off just saying:

    LCDOUT "BAD"

    Sure could use some ideas on how to free up some space. Thanks,
    Gary
    Last edited by g-hoot; - 27th January 2007 at 17:32.

Similar Threads

  1. Parsing Strings...
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 15th February 2009, 04:13
  2. Please help with storing strings in codespace
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th May 2008, 01:02
  3. Processing lengthy strings
    By sougata in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st March 2006, 05:27
  4. I2CWRITE writing Strings to EEPROM
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th March 2005, 19:45
  5. reading 2c strings
    By beto in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 22nd December 2004, 15:26

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