![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hello everyone! I am working on a project using a PIC. The project is a circuit for a car, and I need to retain a variable that the user can set. I have the unit come stock with a certain value for a variable, but then you should be able to adjust the value of the variable. I know how to do all of this, but what I don't know is how to retain the variable after the power is removed from the pic. I assume that my variable will just go back to the normal. Does the pic have any type of permanent memory that you can write the variable to? Also, I still need to find out how to program a 16f819 with PicBasic Pro. What is a good compiler? I have tried to use MicroCode Studio Plus, but it doesn't work with this certain chip. Any advice on either of these questions would be greatly appreciated. Thanks! | |
| |
| | (permalink) |
| it's called eeprom | |
| |
| | (permalink) |
| Many of the PIC's have in-built EEPROM, the 16x84 series have 64 bytes, and the 16F628 has 128 bytes. Check the specs at MicroChip and pick a chip that includes it. | |
| |
| | (permalink) |
| in your code, just don't set the intiial value. as long as you don't change it in your code. it will still be there. Think of it this way your program memory stays, so shall any register you changed. | |
| |
| | (permalink) | |
| Quote:
You should save the file to EEPROM when it is changed and get it out of EEPROM every time the pic powers up. | ||
| |
| | (permalink) | ||
| Quote:
int help; main() { printf("%c", help); help=getc(); } if I run this program and enter "f" as my getc(), then disconnect power, after I reconnect power help will still be "f". | |||
| |
| | (permalink) | |
| Quote:
Many PIC's have data EEPROM built-in, it's trivial to store any settings you want there and reload them during program initialisation - and it's guaranteed to be maintained - for many years - guaranteed minimum specs are available from the MicroChip website. | ||
| |
| | (permalink) | |||
| Quote:
| ||||
| |