Electronic Components Datasheet Search
  English  ▼

X  

AN1324 Datasheet(PDF) 10 Page - STMicroelectronics

Part # AN1324
Description  CALIBRATING THE RC OSCILLATOR OF THE ST7FLITE0 MCU USING THE MAINS
PDF  15 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN1324 Datasheet(HTML) 10 Page - STMicroelectronics

Back Button AN1324 Datasheet HTML 6Page - STMicroelectronics AN1324 Datasheet HTML 7Page - STMicroelectronics AN1324 Datasheet HTML 8Page - STMicroelectronics AN1324 Datasheet HTML 9Page - STMicroelectronics AN1324 Datasheet HTML 10Page - STMicroelectronics AN1324 Datasheet HTML 11Page - STMicroelectronics AN1324 Datasheet HTML 12Page - STMicroelectronics AN1324 Datasheet HTML 13Page - STMicroelectronics AN1324 Datasheet HTML 14Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 10 / 15 page
background image
10/15
CALIBRATING THE RC OSCILLATOR OF THE ST7FLITE0 MCU USING THE MAINS
jrnc
nocarry
;this equation is calculated with 16 bits
inc
X
;
nocarry sub
A, capture1
;MSB are in register X
jrnc
noneg
;
dec
X
;and LSB in register A.
noneg
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.1.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.1.3 timebase interrupt
ld
A, LTCSR
;clear TB bit
inc
nbover
;increment number of overflows
endit2 iret
4.1.4 writing in eeprom
To store final value of RCCR in EEPROM, add theses lines after disabling the timer interrupts
in the main program.
ld
RCCR, A
bset
EECSR,#1
;start to enter value in the EEPROM
ld
$1003,A
;load value of the RCCR in EEPROM
bset
EECSR,#0
;start to write in the EEPROM
wait
btjt
EECSR,#0,wait
;wait for the end of writing in EEPROM



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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