| 数据搜索系统,热门电子元器件搜索 |
|
AN1324 数据表(PDF) 13 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1324 数据表(HTML) 13 Page - STMicroelectronics |
|
13 / 15 page ![]() 13/15 CALIBRATING THE RC OSCILLATOR OF THE ST7FLITE0 MCU USING THE MAINS nocarry sub A, (capture1,Y);MSB are in register X jrnc noneg ; dec X ;and LSB in register A. noneg inc Y cp Y,#$4 jrne calcul srl A ;these lines calculate the average of the last four srl X ;measures by dividing their total by 4. It is done by jrnc carry1 ;two consecutive right shift on the 16 bit result. add A,#$80 carry1 srl A srl X jrnc carry2 add A,#$80 carry2 cp X, #$01 ;if mains frequency is 50Hz the reference value is $138 jrmi minus ;if it is 60Hz the reference is $104.the program first jreq compare ;compares MSB with $01 and then compare LSB with jp plus ;$38 for 50Hz and $04 for 60Hz. if the calculated compare cp A, #$38 ;value is smaller than the reference the program jump to jrmi minus ;minus to decrease RCCR else it increase RCCR plus ld A, RCCR add A, value ;add value if counted value is greater than ref jp new minus ld A, RCCR sub A, value ;subtract value if Y is smaller new ld RCCR,A ;enter the new value in RCCR btjf value, #0, next;stop after 7 rounds loop jp loop 4.2.2 input capture interrupt ld A, LTICR ;load captured value in A btjt LTCSR, #4, finish ;test if it is first or second capture bset LTCSR, #4 ;allow timebase interrupt in order to count the number of overflows ld capture1, A ;captured value is stored in capture1 jp endit1 finish ld capture2, A ;if it is the second capture, captured value is stored in capture2 clr cr ;clear cr to end the count endit1 iret 4.2.3 timebase interrupt ld A, LTCSR ;clear TB bit inc nbover ;increment number of overflows endit2 iret |
|
|
链接网址 |
| 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 |