A device for controlling the cycles for refreshing data stored in rewritable non-volatile memory, said rewritable non-volatile memory being composed of a plurality of memory blocks, the device comprising: - a temperature sensor adapted to measure the temperature of the rewritable non-volatile memory and to provide a value representative of the measured temperature; and - a control module , comprising an encoder adapted to encode the value representative of the measured temperature into an encoded value proportional to the impact of the instantaneous temperature on the retention time in the rewritable non-volatile memory; the device being characterized in that the control module further comprises: - an adder coupled to the encoder and to a status register , the adder receiving as input the output value of the encoder and a last state value stored in the status register in order to provide a resultant value, the last state value stored in the status register corresponding to the accumulation of previously encoded values such that the state of the status register is proportional to the global impact of the evolution of the temperature on the retention time; and in that the status register is coupled to a microcontroller to determine if the resultant value is increased by an amount which is higher than a predefined threshold value, said threshold value corresponding to the time or a fraction of the minimal retention time of the memory blocks; and to: - return to the temperature measuring step, if the resultant value is increased by an amount which is lower than the predefined threshold value; or - if the resultant value is increased by an amount which is higher than or equal to the predefined threshold value: - generate an alert signal warning of imminent loss of data; - evaluate the retention time remaining for each block of the rewritable non-volatile memory; and - according to the result for each memory block, operate or not a refresh of the data in said memory block and return to the temperature measuring step. - a temperature sensor adapted to measure the temperature of the rewritable non-volatile memory and to provide a value representative of the measured temperature; and - a control module , comprising an encoder adapted to encode the value representative of the measured temperature into an encoded value proportional to the impact of the instantaneous temperature on the retention time in the rewritable non-volatile memory; - an adder coupled to the encoder and to a status register , the adder receiving as input the output value of the encoder and a last state value stored in the status register in order to provide a resultant value, the last state value stored in the status register corresponding to the accumulation of previously encoded values such that the state of the status register is proportional to the global impact of the evolution of the temperature on the retention time; - return to the temperature measuring step, if the resultant value is increased by an amount which is lower than the predefined threshold value; or - if the resultant value is increased by an amount which is higher than or equal to the predefined threshold value: - generate an alert signal warning of imminent loss of data; - evaluate the retention time remaining for each block of the rewritable non-volatile memory; and - according to the result for each memory block, operate or not a refresh of the data in said memory block and return to the temperature measuring step. - generate an alert signal warning of imminent loss of data; - evaluate the retention time remaining for each block of the rewritable non-volatile memory; and - according to the result for each memory block, operate or not a refresh of the data in said memory block and return to the temperature measuring step. <EOS>