EmbeddedRelated.com
Forums
Memfault Beyond the Launch

writing to Program memory in PIC controllers

Started by aroravaibhav87 January 2, 2008
On Jan 4, 1:35=A0pm, Chris H <ch...@phaedsys.org> wrote:

> I thought that until some one sent me a link to the case history. =A0Turns=
> out McDonnell's were intentionally running their coffee some 20 degrees > hotter than anyone else for reasons of storage life when brewed. =A0On a
Tip of the iceberg, as far as lawsuits vs. frivolity go. BTW that story was always very counter-intuitive to me - I would expect that increasing the temp would REDUCE the shelf life. Very strange.
In message 
<d1c3c5ab-85d2-4bf8-b031-7b3ac2fc8b22@f3g2000hsg.googlegroups.com>, 
larwe <zwsdotcom@gmail.com> writes
>On Jan 4, 1:35&#4294967295;pm, Chris H <ch...@phaedsys.org> wrote: > >> I thought that until some one sent me a link to the case history. &#4294967295;Turns >> out McDonnell's were intentionally running their coffee some 20 degrees >> hotter than anyone else for reasons of storage life when brewed. &#4294967295;On a > >Tip of the iceberg, as far as lawsuits vs. frivolity go.
Yes.
>BTW that story was always very counter-intuitive to me - I would >expect that increasing the temp would REDUCE the shelf life. Very >strange.
Me too. Never did work it out. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
>On Jan 2, 11:23=A0am, "aroravaibhav87" <aroravaibha...@gmail.com> wrote: >> With reference to the
dochttp://www.avrfreaks.net/index.php?name=3DPNphpBB=
>2&file=3Dviewtopic&t=3D380... >> >> ,it's possible to write directly into the program memory section in
AVR
>> controller ,I would like to know whether it is possible to follow a >> similar kind of procedure for PIC controllers as well. > >After looking at the link you posted, it looks to me like you want to >know how to store C language constants in flash memory? That is, you >want to compile them into your code, and burn them into the target >chip at the same time you download your program, right? > >That is certainly possible with the PIC24/dsPIC devices. They have a >special architecture that lets you map the 24-bit program memory bus >over to the 16-bit data memory bus. I think this is called Program >Visibility, or something like that. C30 handles that for you >automatically. > >There's actually 2 ways to view program memory as data on that chip >family. The other is via a special table assembler instruction. C30 >supports both of these, and you don't have to know the underlying >details. > >const char buf[] =3D "abc"; // constant data is stored in flash and >accessed automatically via Program Visibility (you write zero code) > >char buf[] =3D "abc"; // this is an initialized value. It's stored in >flash and copied to RAM in the startup code. That uses the table >method internally. This is a little more memory efficient because it >can use every byte of flash. The Program Visibility method actually >wastes 1 byte out of every 3 because 24 bits don't map directly to 16 >bits. But Program Visibility lets you directly read flash data at >runtime without first copying them over to RAM, which is needed with >non-consts. > >My discussion above does NOT tell you how to write to flash memory at >runtime. This is strictly a discusssion of how to store constants in >flash at the time you download your program to the chip. Writing to >flash at runtime is much harder. > >Eric > >
Thanks for all the info , the two methods that you described work fine , but I was actually for a way by which I could store some constants into the chip independent of the program itself, ie I do not have to write the data variables in the program itself, but download the variables in the program flash directly.
>On Jan 2, 11:23=A0am, "aroravaibhav87" <aroravaibha...@gmail.com> wrote: >> With reference to the
dochttp://www.avrfreaks.net/index.php?name=3DPNphpBB=
>2&file=3Dviewtopic&t=3D380... >> >> ,it's possible to write directly into the program memory section in
AVR
>> controller ,I would like to know whether it is possible to follow a >> similar kind of procedure for PIC controllers as well. > >After looking at the link you posted, it looks to me like you want to >know how to store C language constants in flash memory? That is, you >want to compile them into your code, and burn them into the target >chip at the same time you download your program, right? > >That is certainly possible with the PIC24/dsPIC devices. They have a >special architecture that lets you map the 24-bit program memory bus >over to the 16-bit data memory bus. I think this is called Program >Visibility, or something like that. C30 handles that for you >automatically. > >There's actually 2 ways to view program memory as data on that chip >family. The other is via a special table assembler instruction. C30 >supports both of these, and you don't have to know the underlying >details. > >const char buf[] =3D "abc"; // constant data is stored in flash and >accessed automatically via Program Visibility (you write zero code) > >char buf[] =3D "abc"; // this is an initialized value. It's stored in >flash and copied to RAM in the startup code. That uses the table >method internally. This is a little more memory efficient because it >can use every byte of flash. The Program Visibility method actually >wastes 1 byte out of every 3 because 24 bits don't map directly to 16 >bits. But Program Visibility lets you directly read flash data at >runtime without first copying them over to RAM, which is needed with >non-consts. > >My discussion above does NOT tell you how to write to flash memory at >runtime. This is strictly a discusssion of how to store constants in >flash at the time you download your program to the chip. Writing to >flash at runtime is much harder. > >Eric > >
Thanks for all the info , the two methods that you described work fine , but I was actually for a way by which I could store some constants into the chip independent of the program itself, ie I do not have to write the data variables in the program itself, but download the variables in the program flash directly.

Memfault Beyond the Launch