----- Original Message ----- From: "ivp" To: "Microcontroller discussion list - Public." Sent: Friday, March 12, 2010 3:01 AM Subject: Re: [PIC]Storing values in a PIC when shutting down >>> I have data sets, and I need to incorporate them into the >>> microcontroller so that it can provide the simulated sensor voltages >>> >>> What kind of memory do I need for this? Is this where EEPROM >>> comes in? Or is there another type of memory for this? > > This sounds like a use for Flash tables. If you've got an 18F or later, > tables have their own instructions > > For example, to retrieve a byte from an 18F table, where "t_base" is > a 24-bit address > > mov upper(t_base),tblptru ;table base address <23:16> > mov high(t_base),tblptrh ;table base address <15:8> > mov low(t_base),tblptrl ;table base address <7:0> > tblrd*+ ;read, increment pointer > movff tablat,temp ;retrieve data from address, copy to temp er, not quite right... should be: movlw upper(t_base) movwf tblptru movlw high(t_base) movwf tblptrh movlw low(t_base) movwf tblptrl etc. > tblptrx can have W added to them. It's all in the datasheet > > If you have something like the 16F, a table stored in Flash can be > accessed with eecon1,eepgd set, target address in eeadr and eeadrh > and data in eedata and eedath. Note that for the 16F it's one byte > of 14-bits, for the 18F it's 2 bytes of 8-bits > >> Preferably you would do the writing BEFORE shutting down, not >> WHILE shutting down. EEPROM writes are only guaranteed down >> to a certain(dependent on device) operating voltage and they are not >> instantaneous > > Bob, despite the Subject, Jason didn't actually mention shutting > down !!! Had me wondering there for a sec > > Joe > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist