Shop OBEX P1 Docs P2 Docs Learn Events
Variable Value Changes Unexpectedly — Parallax Forums

Variable Value Changes Unexpectedly

ArchiverArchiver Posts: 46,084
edited 2004-04-26 13:37 in General Discussion
I have been having trouble with a variable whose value suddenly
changes. The variable is supposed to increment from 1 to 250 in
increments of one and then when it is greater than 250 the program is
to end. I am finding that suddenly for no apparent reason the byte
variable suddenly jumps to greater than 250 and the program ends and
the variable never completed the loop count. This happens
intermitently (sp??) and the program has to run several hours before
it does the "burp". I realize there could be many issues but I have
wrestled with this for some time and I'm starting to be suspicious
that it may be a memory pointer type of problem. According to my
memory map I have 11 bits of available memory left. I am not writing
to EEPROM anything using the WRITE statement and the variable is used
nowhere else except in this routine. Anyone have any ideas about what
could cause this?

Kind Regards,
Eric

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-23 22:49
    Are you aliasing (overlaying) variables? This is usually what causes
    these mysteries.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Eric Berg [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ss0aJepwLuzGhbTPCOnOPchl5p85FlToLoszVIku9MNV_x1TL7CgCHaPjrYdWGaZUZIu3aEuwXooi2GawQ]khufumen@y...[/url
    Sent: Friday, April 23, 2004 3:56 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Variable Value Changes Unexpectedly


    I have been having trouble with a variable whose value suddenly
    changes. The variable is supposed to increment from 1 to 250 in
    increments of one and then when it is greater than 250 the program is
    to end. I am finding that suddenly for no apparent reason the byte
    variable suddenly jumps to greater than 250 and the program ends and
    the variable never completed the loop count. This happens
    intermitently (sp??) and the program has to run several hours before
    it does the "burp". I realize there could be many issues but I have
    wrestled with this for some time and I'm starting to be suspicious
    that it may be a memory pointer type of problem. According to my
    memory map I have 11 bits of available memory left. I am not writing
    to EEPROM anything using the WRITE statement and the variable is used
    nowhere else except in this routine. Anyone have any ideas about what
    could cause this?

    Kind Regards,
    Eric
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-24 12:52
    Unsure as to what you mean by aliasing variables?



    --- Jon Williams <jwilliams@p...> wrote:
    > Are you aliasing (overlaying) variables? This is
    > usually what causes
    > these mysteries.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: Eric Berg [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wJ8b7RpIP3tu6tMqJl5AGBUaIcXile3j5mc0dlKMejSxT9pI4qOU1dI21EdfR9taUrf-TwpHKhJ8JHP7zw]khufumen@y...[/url
    > Sent: Friday, April 23, 2004 3:56 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Variable Value Changes
    > Unexpectedly
    >
    >
    > I have been having trouble with a variable whose
    > value suddenly
    > changes. The variable is supposed to increment from
    > 1 to 250 in
    > increments of one and then when it is greater than
    > 250 the program is
    > to end. I am finding that suddenly for no apparent
    > reason the byte
    > variable suddenly jumps to greater than 250 and the
    > program ends and
    > the variable never completed the loop count. This
    > happens
    > intermitently (sp??) and the program has to run
    > several hours before
    > it does the "burp". I realize there could be many
    > issues but I have
    > wrestled with this for some time and I'm starting to
    > be suspicious
    > that it may be a memory pointer type of problem.
    > According to my
    > memory map I have 11 bits of available memory left.
    > I am not writing
    > to EEPROM anything using the WRITE statement and the
    > variable is used
    > nowhere else except in this routine. Anyone have any
    > ideas about what
    > could cause this?
    >
    > Kind Regards,
    > Eric
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    > Yahoo! Groups Links
    >
    >
    > basicstamps-unsubscribe@yahoogroups.com
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-25 16:02
    Aliasing refers to giving the same RAM location two different names.
    For example:

    hrsBCD VAR Byte
    hrs10 VAR hrsBCD.NIB1
    hrs01 VAR hrsBCD.NIB0

    While I have three definitions, only one byte of RAM is actually
    defined. If hrsBCD gets changed, then the will be changes in hrs10 or
    hrs01 or maybe both. And, if I change either hrs10 or hrs01, the WILL
    be a change in hrsBCD.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: Eric [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=MN88c7nge9WabLpnYruZKyMEQdzuoMRIefYsZTZCVJLUZ1hV14hgMQJkWz-RiZTgA3GeRf5LDug]khufumen@y...[/url
    Sent: Saturday, April 24, 2004 6:52 AM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Variable Value Changes Unexpectedly


    Unsure as to what you mean by aliasing variables?



    --- Jon Williams <jwilliams@p...> wrote:
    > Are you aliasing (overlaying) variables? This is
    > usually what causes
    > these mysteries.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: Eric Berg [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=MN88c7nge9WabLpnYruZKyMEQdzuoMRIefYsZTZCVJLUZ1hV14hgMQJkWz-RiZTgA3GeRf5LDug]khufumen@y...[/url
    > Sent: Friday, April 23, 2004 3:56 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Variable Value Changes
    > Unexpectedly
    >
    >
    > I have been having trouble with a variable whose
    > value suddenly
    > changes. The variable is supposed to increment from
    > 1 to 250 in
    > increments of one and then when it is greater than
    > 250 the program is
    > to end. I am finding that suddenly for no apparent
    > reason the byte
    > variable suddenly jumps to greater than 250 and the
    > program ends and
    > the variable never completed the loop count. This
    > happens
    > intermitently (sp??) and the program has to run
    > several hours before
    > it does the "burp". I realize there could be many
    > issues but I have
    > wrestled with this for some time and I'm starting to
    > be suspicious
    > that it may be a memory pointer type of problem.
    > According to my
    > memory map I have 11 bits of available memory left.
    > I am not writing
    > to EEPROM anything using the WRITE statement and the
    > variable is used
    > nowhere else except in this routine. Anyone have any
    > ideas about what
    > could cause this?
    >
    > Kind Regards,
    > Eric
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-26 13:37
    Dang it you aren't right! I did have the variable
    aliased. Works great now. Thank you very much for your
    help.

    Eric

    --- Jon Williams <jwilliams@p...> wrote:
    > Aliasing refers to giving the same RAM location two
    > different names.
    > For example:
    >
    > hrsBCD VAR Byte
    > hrs10 VAR hrsBCD.NIB1
    > hrs01 VAR hrsBCD.NIB0
    >
    > While I have three definitions, only one byte of RAM
    > is actually
    > defined. If hrsBCD gets changed, then the will be
    > changes in hrs10 or
    > hrs01 or maybe both. And, if I change either hrs10
    > or hrs01, the WILL
    > be a change in hrsBCD.
    >
    > -- Jon Williams
    > -- Applications Engineer, Parallax
    > -- Dallas Office
    >
    >
    >
    Original Message
    > From: Eric [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=XpWKkScq18bH22LWph6M6eg4A5NMF7-UV7q5Qf9JKJNqjx7SiXiNdpxdULCSETZDD9vubVAxxwjCzA]khufumen@y...[/url
    > Sent: Saturday, April 24, 2004 6:52 AM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Variable Value Changes
    > Unexpectedly
    >
    >
    > Unsure as to what you mean by aliasing variables?
    >
    >
    >
    > --- Jon Williams <jwilliams@p...> wrote:
    > > Are you aliasing (overlaying) variables? This is
    > > usually what causes
    > > these mysteries.
    > >
    > > -- Jon Williams
    > > -- Applications Engineer, Parallax
    > > -- Dallas Office
    > >
    > >
    > >
    Original Message
    > > From: Eric Berg [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=XpWKkScq18bH22LWph6M6eg4A5NMF7-UV7q5Qf9JKJNqjx7SiXiNdpxdULCSETZDD9vubVAxxwjCzA]khufumen@y...[/url
    > > Sent: Friday, April 23, 2004 3:56 PM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Variable Value Changes
    > > Unexpectedly
    > >
    > >
    > > I have been having trouble with a variable whose
    > > value suddenly
    > > changes. The variable is supposed to increment
    > from
    > > 1 to 250 in
    > > increments of one and then when it is greater than
    > > 250 the program is
    > > to end. I am finding that suddenly for no apparent
    > > reason the byte
    > > variable suddenly jumps to greater than 250 and
    > the
    > > program ends and
    > > the variable never completed the loop count. This
    > > happens
    > > intermitently (sp??) and the program has to run
    > > several hours before
    > > it does the "burp". I realize there could be many
    > > issues but I have
    > > wrestled with this for some time and I'm starting
    > to
    > > be suspicious
    > > that it may be a memory pointer type of problem.
    > > According to my
    > > memory map I have 11 bits of available memory
    > left.
    > > I am not writing
    > > to EEPROM anything using the WRITE statement and
    > the
    > > variable is used
    > > nowhere else except in this routine. Anyone have
    > any
    > > ideas about what
    > > could cause this?
    > >
    > > Kind Regards,
    > > Eric
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    > Yahoo! Groups Links
    >
    >
    > basicstamps-unsubscribe@yahoogroups.com
    >
    >
    >
Sign In or Register to comment.