Searching \ for '[PIC]: It is possible to use program memory as dat' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/memory.htm?key=memory
Search entire site for: 'It is possible to use program memory as dat'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: It is possible to use program memory as dat'
2000\08\21@195654 by ?=

flavicon
face
   Hi All:

   The point is, I'd like to have some memory that doesn't "leave" with
lost power, I mean, if I made a change of some memory value (variable) it
remains even though I turn the device off...

   I guess I´m not clear, so I'll try to improve...

   I.e. I have a device that counts external events, let's say I've already
counted 5 (I'm storing that data in a variable) in that moment I turn the
device off, but next time I want my device to begin counting from 5 to up...
It is possible to do? if the answer is yes, please tell me how...

   That's why I was thinking of using program memory as data memory...

   Thanks in advance,

   Gonzalo

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu>

2000\08\21@202234 by Bob Ammerman

picon face
Use a PIC with built-in EEPROM data memory, like the 16F84 for example.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\22@013608 by w. v. ooijen / f. hanneman

picon face
>     That's why I was thinking of using program memory as data memory...
Can be done of F877 and the likes.
But this is exactly what data eeprom is for (16F84 etc)!
Or add an external (i2c, spi) eeprom....
Wouter

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@071907 by Bob Ammerman

picon face
Exactly,

You _can_ use program memory as data memory on the F877, etc. There are two
issues with doing so:

1: While writing to data eeprom your program can continue to do other
things. A status bit is set and an interrupt optionally generated after the
write completes. However, when writing to program memory the CPU is stopped
until the write complete.

2: The endurance figure (number of time each memory location can be written)
is typically much lower for program memory than for data eeprom. From the
'F877 data sheet: "The EEPROM data memory is rated for high erase/
write cycles."  (Does anybody know the actual endurance numbers for program
and data eeprom?)

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\22@072757 by Michael Rigby-Jones

flavicon
face
{Quote hidden}

Page 162 of the databook states 100K minimum erase/write cycles for the data
EEPROM memory, and 1000 cycles minimum for the program FLASH memory.  Quite
a difference!

Mike

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@074427 by Bob Ammerman

picon face
> Page 162 of the databook states 100K minimum erase/write cycles for the
data
> EEPROM memory, and 1000 cycles minimum for the program FLASH memory.
Quite
> a difference!


Ok, this brings up another point.

Obviously it is rather easy to exceed the 1000 programming cycles on code
memory.

On the other hand, you may think you'll never reach 100,000 cycles for data
eeprom. However, if you don't write your code carefully you could easily
exceed this number. If you do need more writes, you can use 'load-levelling'
techniques to spread the writes across many memory locations.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)


> Mike
>
> --
> http://www.piclist.com hint: PICList Posts must start with ONE topic:
> [PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@080342 by Olin Lathrop

flavicon
face
>>
   The point is, I'd like to have some memory that doesn't "leave" with
lost power, I mean, if I made a change of some memory value (variable) it
remains even though I turn the device off...
<<

This is called "non-volatile" memory.  Some PICs have this implemented in
the form of EEPROM.  The little 12CE518, for example, has 16 bytes of
EEPROM, while the 16F877 has 256 bytes.  Flash parts like the 16F877 also
have means of writing to the program memory at run time, but the processor
goes to lunch for quite a while when you do that.

If none of the PICs with built in EEPROM is the right choice or you need a
lot more non-volatile memory, you can hook up external EEPROM chips via SPI
or IIC.  The IIC protocol to drive an EEPROM is very easy to implement in
software, and doesn't actually require an IIC module.  SPI is a bit more
complicated, requires more pins, but can be faster.  If you really need
speed and large space, you can set up your own bus arrangement and use
external parallel EEPROM or battery backed RAM, or whatever.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, .....olinKILLspamspam.....cognivis.com, http://www.cognivis.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@110936 by ?=

flavicon
face
   First of all thanks to all of you for spending some time answering my
question...

   Well, I was thinking in some kind of battery backed PIC also, I guess is
simple but I don't know how to do it really well... I was searching the
Internet for some schematics but I didn't find anything useful... I suppose
it is possible to supply power to a PIC using line voltage, but in case of
power lost, change instantly to a battery, so, no loose neither data nor
program running...

   Thanks again, I hope you can help me one more time...

   Gonzalo

{Original Message removed}

2000\08\22@121436 by Byron A Jeff

face picon face
>
>     First of all thanks to all of you for spending some time answering my
> question...
>
>     Well, I was thinking in some kind of battery backed PIC also, I guess is
> simple but I don't know how to do it really well... I was searching the
> Internet for some schematics but I didn't find anything useful... I suppose
> it is possible to supply power to a PIC using line voltage, but in case of
> power lost, change instantly to a battery, so, no loose neither data nor
> program running...
>
>     Thanks again, I hope you can help me one more time...
>
>     Gonzalo

You really don't need a true battery backed system if you have EEPROM
available. However you will need a soft poweroff instead of a hard poweroff.

1) When the user presses the off button, instead of removing power from the
  unit, it signals the PIC for shutdown.

Then you have two possibilies.

A2) Do a controlled shutdown by writing the value you want to retain to the
  EEPROM area.
A3) Remove power from the PIC.

or

B2) remove power from everything but the PIC.
B3) Put the PIC to sleep never actually removing power from it.

A PIC that's asleep ony requires microamps of power to maintain its state.
However it does need power. So if it were plugged into a wall wart and then
moved to another location it would lose its contents.

Anyone have an idea of how to hook up a logic level MOSFET so that a PIC
can be push button started but turned off via software?

BAJ

>
> {Original Message removed}

2000\08\22@124220 by Bob Ammerman

picon face
Depending on your power supply, you can set up a 'powerfail interrupt'. If
you have enough capacitance in the supply you can write the state on the way
down.

This is very dangerous if you don't get it right, it is easy to trash your
non-volatile state.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\22@131527 by Andrew Kunz

flavicon
face
>Depending on your power supply, you can set up a 'powerfail interrupt'. If
>you have enough capacitance in the supply you can write the state on the way
>down.
>
>This is very dangerous if you don't get it right, it is easy to trash your
>non-volatile state.

I did this once using a Zener to serve as a reference voltage.  It would
generated a low-going edge when the supply voltage feeding my 5V regulator
dropped below a threshold.  I would have plenty of time to shut off the motors
(which would cause the voltage to rise again GRRR), save data to EE, and then
would sit and wait for a power fail reset or a "false alarm" (timeout).

The false alarm part was added because shutting off the motor power would cause
the supply voltage to rise again.  I had to wait a settling time (resistive
bleed of input cap) before I could be sure of the power really failing.  A
stalled motor would suck electrons down, making it look like a power failure.
If I got two of these within a second, I could report "jam" to the operator.

Andy

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@134453 by W. K. Brown

flavicon
face
       We used to call these 'Last Gasp Routines'. In general they are
unreliable
       and were always deleted for production software. On occasion they
were
       good for debug.
       Keith

       {Original Message removed}

2000\08\22@183537 by Bob Ammerman

picon face
Not _always_ unreliable.

Back in the days of core (non-volatile) main memory they were a great way
for the system to save its volatile state on the way down.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

----- Original Message -----
From: W. K. Brown <EraseMEkbrownspam_OUTspamTakeThisOuTMARSH-MCBIRNEY.COM>
To: <PICLISTspamspam_OUTMITVMA.MIT.EDU>
Sent: Tuesday, August 22, 2000 1:42 PM
Subject: Re: [PIC]: It is possible to use program memory as data memory?


>         We used to call these 'Last Gasp Routines'. In general they are
> unreliable
>         and were always deleted for production software. On occasion they
> were
>         good for debug.
>         Keith
>
>         {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...