Skip to main content
Visitor II
December 7, 2023
Question

STM8L052 flash read/write to activate function

  • December 7, 2023
  • 1 reply
  • 1042 views

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!

    This topic has been closed for replies.

    1 reply

    Visitor II
    December 10, 2023

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