SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By svt07
#189841
Hi ,
I need to build a fan controller with 3 speeds , so I will have 3 buttons , . I am thinking to use a pic , 16f877..
the question , will the chip remembers the the speed , if the power goes off? I just started to learn micro controllers.
thanks
User avatar
By phalanx
#189851
Hi svt07,

The 16F877 has built in EEPROM memory which is non-volatile. That means anything you write to it will be retained after a power loss. You can also write the internal flash memory of the part which will work in the same manner. The difference between the two is the EEPROM memory will tolerate an order of magnitude more write cycles than the flash program memory.

All that being said, the 16F877 and its first replacement, the 16F877A, are approaching end of life and aren't recommended for new designs. The current production part is the 16F887 that has some additional capabilities but is otherwise identical to the others. If you already have a 16F877, then go ahead and use it since it will suit your purposes. If you have to order a new microcontroller, consider the 16F887.

-Bill
By svt07
#189853
Thank for your reply,
Probably I need to explain for I am trying to find out.
I need to build a controller, with software wich remembers last button pressed.
For example, button #2 was pressed, the motor has its speed, when power goes off and on, I want the motor has the same speed. No reseting. I just need a ddirection where to start to learn. Maybe I have to choose different chip.
By skimask
#189856
Maybe you didn't read post #2.
So, I'll cut and paste the relevant pieces below...

Hi svt07,

The 16F877 has built in EEPROM memory which is non-volatile. That means anything you write to it will be retained after a power loss. You can also write the internal flash memory of the part which will work in the same manner. The difference between the two is the EEPROM memory will tolerate an order of magnitude more write cycles than the flash program memory.

All that being said, the 16F877 and its first replacement, the 16F877A, are approaching end of life and aren't recommended for new designs. The current production part is the 16F887 that has some additional capabilities but is otherwise identical to the others. If you already have a 16F877, then go ahead and use it since it will suit your purposes. If you have to order a new microcontroller, consider the 16F887.

-Bill

Notice I cut-and-pasted everything?

What don't you understand?

What part of the above can you not Google and figure out?
By svt07
#189857
You don't need repeat your post... I know everything what write to program stays after power shutdown...
I am asking how to make program rewrite it itself. Read my post... I want when I push button program writes this port as starting port, and after shutdown it remembers which button was pressed... I need 4 buttons, every time i push button #1, or #2, or#3,
program rewrites the port as starting port.
By skimask
#189863
(sigh)...

"The 16F877 has built in EEPROM memory which is non-volatile. That means anything you write to it will be retained after a power loss. ......"


See any relationship between having EEPROM on a microchip and you're need to retain settings between power cycles?

Don't rewrite the program.
Rewrite the way you're going about it.
User avatar
By phalanx
#189873
There is a section of the datasheet that provides details on how to use the EEPROM of the device. Download the datasheet and read everything you can about it. It's quite easy to use. If this is going to be a C project, there may be some commands built into the compiler or part of the peripheral libraries that may do most of the work for you. I'm not readily familiar with the 8-bit C compilers so you will have to look into that one yourself.

-Bill