cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L052 flash read/write to activate function

Botoni
Associate

Hello to all!

I'm a bit new to STM8 programming. I'm my current project using the STM8L052 board, my plan is to use a input of how many times the user press a button to activate or deactive a function. For example, if the user press the button 5 times during the initialization process of the board, the function is activated. In the next initialization, the function must be active as well. However, if the user press the button 5 times again during another initialization, the function must be deactivated. My logic is as follows:

 

>> Initialization

      - func (check flash memory) -> check if the memory location has the value (X var) to activate the desired A function

      - func (check if the button was pressed 5 times) -> if the user press the button 5 times, changes the value of the memory location which holds X var value. If not pressed, the value stays the same (A function status does not change)

>> Initialization ends

>> function is executed or not

 

What I'm doing wrong? The pressing of the button does not change the state of the A function activation var

 

Thanks!

1 REPLY 1
AA1
Senior III

How do you change in flash the memory location that have the variable X?
And STM8L052 have 256-bytes of EEPROM.