Blank Variable


Closed Thread
Results 1 to 12 of 12

Thread: Blank Variable

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    24

    Default Blank Variable

    I need to read the first bit of the EEPROM and store that value into a variable. That part is easy, however, I need the program to do something if the EEPROM is empty such as the first time the pic is turned on. I cant set it each time the pic is turned on because I want it to store what was last used.

    eg.

    s1 var byte

    READ 0, s1
    if s1 = "" then s1 = "1" <---- This is where I get errors
    .
    .
    .
    'rest of the program

    How can I change this?

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If the EEPROM has not been changed it will read HEX FF, BIN 11111111 or DEC 255.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Wink

    Hi, Dave

    Gator must be told the numbers to compare to do no use " " ( quotes ) and the "BLANK" value does not exist.

    Suppose it' as a re-used chip ... everything ( 0 -255 ! ) possible as a value.

    Also Note I have received brand new chips which EEPROM had been tested ( value of the location written for the 0, 8, 16, 24, .... th locations , and Zeroes everywhere )...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Good points.

    So maybe the solution for Gator is to write a program to run that will write a known value to the EEPROM then re-program the PIC with the working code.

    Might not be so good for production though.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    Gator just wants the values not to be overwritten @ further power ups ...

    so, it only needs to write a SURE default value @ first programming ( DATA ...)

    I do agree the DATA line must be commented or modified ,if some minor ( ? ) prog mods are done AND he doesn't want to loose previous values.

    But this never happens in real life ... does it ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Idea...
    Not sure exactly how to do it...

    Use WRITECODE to over write the DATA line.

    Where is the DATA line???
    Dave
    Always wear safety glasses while programming.

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. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. set flags within a variable?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 24th October 2006, 11:07
  5. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 21:16

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