Storing a variable in EEPROM


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    PAUSE is limited to 65535 milliseconds (65.534) seconds

  2. #2
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Default

    Do you have an LCD or RS232 connection? If you have either one of these I would suggest sending out the value you are retrieving from the EEprom using the DIG command to display it as it's individual digits.

    Example:
    Code:
    Read eeadr,data
    For x = 2 To 0 Step -1
    Hserout[data DIG x]
    Next x
    This will give you a way to confirm the value you are getting out of the EEPROM, and help you troubleshoot the problem by elimination.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    PAUSE works with up to a 16-bit period. If you use an expression that attempts to load anything greater than 65535 into the registers used for the delay period, they will overflow.

    65535 + 54465 = 120,000. You're probably getting a delay of 1mS * 54465 due to the overflow. That would explain the ~54 S delay period.

    Put together a loop like the one you're using for the LED. You could get several hours (or more) if needed.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Default code correction

    My previous example for viewing your eeprom data for verification was a bit abbreviated, and wouldn't work as stated. So here it is in a more usable form.
    Code:
    DEFINE HSER_TXSTA 20h   ' enable RS232 transmission
    DEFINE HSER_BAUD 19200  ' set to required baud rate on your system
    
    eeadr con 100       ' set to eeprom address for data of interest
    eedata var byte     ' eeprom data storage
    
    getdata
        Read eeadr,eedata               ' retrieve data byte from eeprom
        For x = 2 To 0 Step -1          ' extract 3 digits for display
        eedata = (eedata DIG x) + $30   ' convert to "decimalized" ascii number
        Hserout[eedata]                 ' send ascii out RS232
        Next x                          ' do it for all 3 digits of byte
    With this code added to your program, you can send out, and verify the value of any byte stored in your internal eeprom as a decimalized 3 digit number (readable on any RS232 terminal program).

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. 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
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. 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

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