| 数据搜索系统,热门电子元器件搜索 |
|
AN3140 数据表(PDF) 9 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3140 数据表(HTML) 9 Page - STMicroelectronics |
|
9 / 14 page ![]() AN3140 3-read software workaround Doc ID 16997 Rev 1 9/14 5 3-read software workaround Below you can see a proposal for a software workaround that works for the scenario described in the previous section. This workaround works well in case of the previously described scenario, where READ_Clk is much faster than CNT_Clk, as well as when they have similar frequencies. In the first case the MAX_DIFF should be defined as ‘1’, while in the second case (similar frequencies) a higher value should be selected. This value should be fine tuned depending to the two real frequencies. Example code /* * The following routine implents the 3-read workaround. * MAX_DIFF equals to 5 should work in case of READ_Clk==75MHz and * CNT_Clk==48MHz. */ #define MAX_DIFF 5 bool Timer_Read_Workaround(UINT32 *valid_timer_cnt_value) { UINT32 timer_value1, timer_value2, timer_value3; UINT32 valid_timer_cnt_value; /* To avoid any interrupt that might delay the reading. */ DISABLE_ALL_INTERRUPT; timer_value1 = READ_TIMER_CNT(); timer_value2 = READ_TIMER_CNT(); timer_value3 = READ_TIMER_CNT(); ENABLE_ALL_INTERRUPT; if ((timer_value2 – timer_value1) <= MAX_DIFF) { *valid_timer_cnt_value = timer_value2; } else if ((timer_value3 – timer_value1) <= MAX_DIFF) { *valid_timer_cnt_value = timer_value3; } else if ((timer_value3 – timer_value2) <= MAX_DIFF) { *valid_timer_cnt_value = timer_value2; } else return FALSE; return TRUE; } |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |