terefere 发表于 2022-10-9 03:14:13

time base with good accurate


I need it for energy measure and etc and I cannot find any info about how u made clock in screen. Specially is no matter that delay betwen each call will be not equal, but I want the same as possible call amount in each next hour in many device.
RTC? Timer callbac?

If后要接end 发表于 2022-10-9 09:16:52

The timing function can only be implemented by script timer callback at present

terefere 发表于 2022-10-9 17:53:58

本帖最后由 terefere 于 2022-10-9 18:24 编辑

I made timer callback for every 6 second. 1 hour cycle I take from get_date_time() and I get 570+/-1 calback count instead calculated 600.   
get_date_time() is taken from core clock or RTC?, I not see any I2C request in this time. I try to check CLKOUT frequency at PCF chip and is almost perfect, but when I stop RTC osccilator then time/date clock on the screen still run. You take time from RTC only at reset time?. Next, at work, time clock works from CPU crystal?

If后要接end 发表于 2022-10-10 09:25:42

本帖最后由 If后要接end 于 2022-10-10 09:27 编辑

terefere 发表于 2022-10-9 17:53
I made timer callback for every 6 second. 1 hour cycle I take from get_date_time() and I get 570+/-1 ...
Yes, the RTC operation is implemented by the CPU, and the battery on the back of the screen is used to save the RTC time and maintain the RTC operation after the screen is powered off. In addition, using start_timer to implement the function of counting every 6 seconds, theoretically there will not be such a large numerical difference. How do you test this?

terefere 发表于 2022-10-10 15:46:58

Timer callback increment value every 6s. One hour period I take from minute register in get_date_time and catch value at first change from 59 to 00. Today I will compare get_date_time from phone if core get time from RTC only at reset time.

My task take much core load- every 200ms I take about 150ms. But I not suppose that it is reason for 5% error

If后要接end 发表于 2022-10-10 16:27:14

terefere 发表于 2022-10-10 15:46
Timer callback increment value every 6s. One hour period I take from minute register in get_date_tim ...

Do not use get_data_time() as a timer, It is recommended to use start_timer (timer_id, timeout, countdown, repeat) to start a timer. The later one is more accurate.
页: [1]
查看完整版本: time base with good accurate