Variables will not change to garbage values by themselves. The hardware or =
the firmware can cause them to do so. To prevent them to change, you need t=
o design the hardware and firmware appropriately.=20
Using c is fine, but it does not solve any problem automatically. Declaring=
a variable is fine. Incrementing it is fine. Going to LPM4 is also fine. B=
ut none of these action can prevent the rest of your firmware from changing=
the variable to garbage. As far as I know, even the almighty c has no magi=
c to solve hardware problems either.=20
=20
--- In m...@yahoogroups.com, arunangshu Chandra
w=
rote:
>
>=20
>=20
> Dear All,
>=20
>=20
> =A0=A0=A0=A0=A0=A0=A0=A0 How can prevent that variable change to garbage =
value.
>=20
>=20
> arun
>=20
> ----- Forwarded Message ----
> From: arunangshu Chandra
> To: m...@yahoogroups.com
> Sent: Monday, October 12, 2009 1:31:38 PM
> Subject: [msp430] RAM variable getting garbage while power on to lpm4
>=20
> =A0=20
> Dear All,
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 I have declared in a variable (un=
signed int power_on_count=3D 0;) and then incremented it once in program (n=
ot in timer function) power_on_count+ +, and displaying it on LCD. the vari=
able increment till 0 to 30 while i switch on and off the device. during th=
at period, the microcontroller switch from normal to=A0 lpm4 mode during th=
is period. after that a variable reaches 30 either device gets reset or var=
iable change to garbage.
> =A0=A0=A0=A0=A0=A0=A0=A0=A0
> Arun
>=20
> [Non-text portions of this message have been removed]
>=20
>=20
>=20
>=20
>=20
>=20=20=20=20=20=20=20
>=20
> [Non-text portions of this message have been removed]
>
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )