And then make sure that you retrieve the data prior any initialization routines starts. Honestly have no idea if RAM, in commercial applications, is initialized in any way.RAM will not change during reset unless you power-cycle the PIC.
You can write it to flash. You can write to outboard storage, ...really don't want to use an eeprom.
simple do, using mplab xc8Hi guys
I am using pic18f, are there some special register than I can use to store 2 bytes data and the values won't change after reset instruction? I really don't want to use an eeprom.
Thanks guys!
Not in my one, but I can use program space tho if I really want to.Isn't there some user EEPROM in the PIC18F....?
For 2 bytes; you can use a couple of bus-wide D latch packages or shift it into a shift register.RAM will not change during reset unless you power-cycle the PIC.
Isn't it XC8 automatically initially all variable to 0 when declare?RAM will not change during reset unless you power-cycle the PIC.
Which PIC18?
What language tool?
Warm or cold reset?
You have to customize the C startup file. This is usually an assembly language file that calls _main()Isn't it XC8 automatically initially all variable to 0 when declare?
I believe XC8 initial variable to 0 when declare, but I haven't found how not to do it yet XC8. Mainly I don't know where to look. (Still in the process of reading the xc8 user guild to find what I need)
- PIC18F46J50
- XC8 - Free mode
- RESET by RESET instruction (warm?)
If you use C then all the variables are initialized. But the memory outside the C variables isn't.Isn't it XC8 automatically initially all variable to 0 when declare?
True. Non-initialized variables declared as 'persistent' are not affected by the startup code in XC8. XC8 also provides facilities to save the STATUS register to be able to inspect PD and TO bits for processors that have them in the STATUS reg. See 'MAIN, RUNTIME STARTUP AND RESET' in the XC8 Compiler User's Guide (DS520053). It's section 5.10 in my old one and describes how all variables are treated at startup.If you use C then all the variables are initialized. But the memory outside the C variables isn't.
Also, if I remember correctly you can declare a variable as "persistent" to avoid initialization.
Some parts have EEPROM scratch pad memory which would be exactly right for this use.The PIC18F46Jxx series do not have eeprom on board however; you can easy steal two bytes from program flash. go to microchip applications and software support. (An example should be available)
Picbuster.
You are correct about this program memory spec is100K times according to microchip.Some parts have EEPROM scratch pad memory which would be exactly right for this use.
Program memory is usually flash and has a finite number of write cycles.
In the newest ones?but on some PIC18s may be as low as 100 (sic!).
Not in the newest ones - from some 7-8 years ago - such as PIC18F87J10.In the newest ones?
by Aaron Carman
by Jake Hertz
by Aaron Carman
by Jake Hertz