| Electronic Components Datasheet Search |
|
AN1324 Datasheet(PDF) 2 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1324 Datasheet(HTML) 2 Page - STMicroelectronics |
|
2 / 15 page ![]() 2/15 CALIBRATING THE RC OSCILLATOR OF THE ST7FLITE0 MCU USING THE MAINS 1 CALIBRATION SOFTWARE 1.1 SOFTWARE PRINCIPLE The software algorithm, described in the following flowchart (see Figure 3), uses the mains frequency as a timebase. This timebase allows the microcontroller to test if the RC oscillator frequency is above or below 1 MHz and repeatedly transforms it by dichotomous analysis so that in 7 iterations the RCCR is set to the optimum value. As the timer speed depends on the RC oscillator frequency, it is easy to determine if the oscil- lator is too fast or too slow. The counted value can be obtained by the following equation: Since the frequency of the counter is the frequency of the oscillator divided by 32, if the oscil- lator is at 1 MHz, the result of the count between two edges (which have a 10 ms interval), is 138h for the European standard (220V/50Hz). For the US standard (110V/60Hz) the right value is 104h. Since the goal of the software is to set the RC oscillator frequency to 1 MHz it means obtaining 138h as the result of the count. So if the result of the count is greater than 138h, it means that the frequency is too high so the program increases the value of RCCR in order to decrease the RC oscillator frequency. And if the result is less than 138h, the RCCR is decreased in order to increase the RC oscillator frequency. Figure 1. Dichotomous Analysis of RCCR Value The RCCR register is set to 80h initially by the program, then the dichotomization starts by adding or subtracting 40h and after each iteration the result is divided by two, so that after 7 it- erations the value of RCCR is set with an accuracy of one bit. countedvalue f cpu 32 f mains × --------------------------- = 80h Start Value FFh 0h increase oscillator frequency decrease oscillator frequency RCCR Register 2 |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List 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 |