Storing Text in EEPROM - ideas wanted


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    I am using the internal eeprom on a 16f628a / 648a

  2. #2
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    To add your strings via the DATA command:

    DATA $00,"Switch01",0

    Example of reading the above and displaying it on an lcd:

    For CounterA = 0 to 16
    Read CounterA,value
    If CounterA=0 then goto Main
    LCDOUT value
    Next CounterA

    This should be enough to get you started.

  3. #3
    Join Date
    Aug 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Ok,
    Ive got this far:

    Code:
    INCLUDE "modedefs.bas"		' Modes for SerOut
    
    CMCON = 7					' set portA to digital
    TRISA = %00100000			' Port A all output but MCLR
    TRISB = %00001010			' Port B all output but 1,3 (Si and CCP)
    
    DEFINE DEBUGIN_REG PORTB		' Set Debug pin port
    DEFINE DEBUGIN_BIT 1			' Set Debug pin bit
    DEFINE DEBUGIN_BAUD 9600		' Set Debug baud rate
    DEFINE DEBUGIN_MODE 1			' Set Debug mode: 0 = true, 1 = inverted
    
    DEFINE DEBUG_REG PORTB			' Set Debug pin port
    DEFINE DEBUG_BIT 2				' Set Debug pin bit
    DEFINE DEBUG_BAUD 9600			' Set Debug baud rate
    DEFINE DEBUG_MODE 1				' Set Debug mode: 0 = true, 1 = inverted
    
    
    port1name  var byte[8] 
    name1		var word
    i var byte
    
    Main: ' Display "Waiting for input" every 5 seconds if timeout period expires
        	DEBUGIN 5000, idle, [STR port1name\8\13]
    
    	  	DEBUG "Received: ",STR  port1name\8,13,10
    
    for i = 1 to 8
    	write i,port1name(i)
    	pause 10
    next i
    pause 100
    
    for i = 1 to 8
    	read i, port1name(i)
    next i
    DEBUG "Read eeprom after write: ",STR  port1name\8,13,10
    
    Goto Main
    
    idle: 
    DEBUG "Waiting for input",13,10
    
    for i = 1 to 8
    	read i, port1name(i)
    next i
    DEBUG "Read from eeprom: ",STR  port1name\8,13,10
    
    goto main
    Now, it receives what i enter, and saves it, and displays it fine, however once power is cycled, and it reads from the eeprom, the 1st character is incorrect:

    Received: 12345678
    Read eeprom after write: 12345678
    Waiting for input

    then power cycle

    then i get this:

    Waiting for input
    Read from eeprom: û2345678

    any hints on what i may be doing wrong?
    Also all comms is serial @ 9600, there is no LCD, therefore the LCDout command cant be used....

  4. #4
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    When you said "I want to be able to label (name) the inputs on the status display" I thought you were talking about an LCD.

    When you use the STR command you are starting at 0 not 1.

    Try this instead

    for i = 0 to 7
    read i, port1name[i]
    next i

    AND

    for i = 0 to 7
    write i, port1name[i]
    next i

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. How to define constants that specify eeprom addresses
    By DwayneR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th December 2009, 04:07
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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