Częstotliwości wywołania funkcji obsługi przerwania SIG_OUTPUT_COMPARE2

    -- Sebastian Pawlak, 2004.


Tabela pozwala na wyznaczenie częstotliwości z jaką będzie wywoływana funkcja obsługi przerwania SIG_OUT_COMPARE2. Częstotliwość zależy od kilku parametrów: częstotliwości kwarcu, prescalera, OCR2.

Częstotliwość wyznacza się ze wzoru:
freq. = kwarc / (prescaler * (OCR2 + 1))


Kod źródłowy pliku "init.c":

ASSR = 1 << AS2;
TCCR2 = (1 << WGM21) |
        (1 << CS22) | (1 << CS21) | (1 << CS20);  /* prescaler 1024 */
TIFR = 1 << OCF2;
TIMSK = 1 << OCIE2;
OCR2 = 7;  /* 7 = 4 Hz, przy prescalerze 1024 i kwarcu 32768 Hz */

while (ASSR & (1 << OCR2UB))
    ;

sei();

Dla jakiej częstotliwości kwarcu wygenerować tabelę:

32700 Hz
32768 Hz
1 MHz
1834320 Hz
2 MHz
3686400 Hz
4 MHz
6 MHz
7372800 Hz
8 MHz
8867238 Hz
11059200 Hz
14745600 Hz
16 MHz
18432000 Hz
20 MHz


Kwarc: 7372800 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010247200256288006411520032230400892160017372800
11024360025614400645760032115200846080013686400
210242400256960064384003276800830720012457600
310241800256720064288003257600823040011843200
410241440256576064230403246080818432011474560
510241200256480064192003238400815360011228800
610241028.5712564114.2866416457.1433232914.2868131657.14311053257.143
7102490025636006414400322880081152001921600
8102480025632006412800322560081024001819200
910247202562880641152032230408921601737280
101024654.5452562618.1826410472.7273220945.455883781.8181670254.545
111024600256240064960032192008768001614400
121024553.8462562215.385648861.5383217723.077870892.3081567138.462
131024514.2862562057.143648228.5713216457.143865828.5711526628.571
141024480256192064768032153608614401491520
151024450256180064720032144008576001460800
161024423.5292561694.118646776.4713213552.941854211.7651433694.118
171024400256160064640032128008512001409600
181024378.9472561515.789646063.1583212126.316848505.2631388042.105
191024360256144064576032115208460801368640
201024342.8572561371.429645485.7143210971.429843885.7141351085.714
211024327.2732561309.091645236.3643210472.727841890.9091335127.273
221024313.0432561252.174645008.6963210017.391840069.5651320556.522
23102430025612006448003296008384001307200
24102428825611526446083292168368641294912
251024276.9232561107.692644430.769328861.538835446.1541283569.231
261024266.6672561066.667644266.667328533.333834133.3331273066.667
271024257.1432561028.571644114.286328228.571832914.2861263314.286
281024248.276256993.103643972.414327944.828831779.3101254234.483
2910242402569606438403276808307201245760
301024232.258256929.032643716.129327432.258829729.0321237832.258
3110242252569006436003272008288001230400
321024218.182256872.727643490.909326981.818827927.2731223418.182
331024211.765256847.059643388.235326776.471827105.8821216847.059
341024205.714256822.857643291.429326582.857826331.4291210651.429
3510242002568006432003264008256001204800
361024194.595256778.378643113.514326227.027824908.1081199264.865
371024189.474256757.895643031.579326063.158824252.6321194021.053
381024184.615256738.462642953.846325907.692823630.7691189046.154
3910241802567206428803257608230401184320
401024175.610256702.439642809.756325619.512822478.0491179824.390
411024171.429256685.714642742.857325485.714821942.8571175542.857
421024167.442256669.767642679.070325358.140821432.5581171460.465
431024163.636256654.545642618.182325236.364820945.4551167563.636
4410241602566406425603251208204801163840
451024156.522256626.087642504.348325008.696820034.7831160278.261
461024153.191256612.766642451.064324902.128819608.5111156868.085
4710241502566006424003248008192001153600
481024146.939256587.755642351.020324702.041818808.1631150465.306
4910241442565766423043246088184321147456
501024141.176256564.706642258.824324517.647818070.5881144564.706
511024138.462256553.846642215.385324430.769817723.0771141784.615
521024135.849256543.396642173.585324347.170817388.6791139109.434
531024133.333256533.333642133.333324266.667817066.6671136533.333
541024130.909256523.636642094.545324189.091816756.3641134050.909
551024128.571256514.286642057.143324114.286816457.1431131657.143
561024126.316256505.263642021.053324042.105816168.4211129347.368
571024124.138256496.552641986.207323972.414815889.6551127117.241
581024122.034256488.136641952.542323905.085815620.3391124962.712
5910241202564806419203238408153601122880
601024118.033256472.131641888.525323777.049815108.1971120865.574
611024116.129256464.516641858.065323716.129814864.5161118916.129
621024114.286256457.143641828.571323657.143814628.5711117028.571
631024112.5002564506418003236008144001115200
641024110.769256443.077641772.308323544.615814178.4621113427.692
651024109.091256436.364641745.455323490.909813963.6361111709.091
661024107.463256429.851641719.403323438.806813755.2241110041.791
671024105.882256423.529641694.118323388.235813552.9411108423.529
681024104.348256417.391641669.565323339.130813356.5221106852.174
691024102.857256411.429641645.714323291.429813165.7141105325.714
701024101.408256405.634641622.535323245.070812980.2821103842.254
7110241002564006416003232008128001102400
72102498.630256394.521641578.082323156.164812624.6581100997.260
73102497.297256389.189641556.757323113.514812454.054199632.432
74102496256384641536323072812288198304
75102494.737256378.947641515.789323031.579812126.316197010.526
76102493.506256374.026641496.104322992.208811968.831195750.649
77102492.308256369.231641476.923322953.846811815.385194523.077
78102491.139256364.557641458.228322916.456811665.823193326.582
79102490256360641440322880811520192160
80102488.889256355.556641422.222322844.444811377.778191022.222
81102487.805256351.220641404.878322809.756811239.024189912.195
82102486.747256346.988641387.952322775.904811103.614188828.916
83102485.714256342.857641371.429322742.857810971.429187771.429
84102484.706256338.824641355.294322710.588810842.353186738.824
85102483.721256334.884641339.535322679.070810716.279185730.233
86102482.759256331.034641324.138322648.276810593.103184744.828
87102481.818256327.273641309.091322618.182810472.727183781.818
88102480.899256323.596641294.382322588.764810355.056182840.449
89102480256320641280322560810240181920
90102479.121256316.484641265.934322531.868810127.473181019.780
91102478.261256313.043641252.174322504.348810017.391180139.130
92102477.419256309.677641238.710322477.41989909.677179277.419
93102476.596256306.383641225.532322451.06489804.255178434.043
94102475.789256303.158641212.632322425.26389701.053177608.421
9510247525630064120032240089600176800
96102474.227256296.907641187.629322375.25889501.031176008.247
97102473.469256293.878641175.510322351.02089404.082175232.653
98102472.727256290.909641163.636322327.27389309.091174472.727
9910247225628864115232230489216173728
100102471.287256285.149641140.594322281.18889124.752172998.020
101102470.588256282.353641129.412322258.82489035.294172282.353
102102469.903256279.612641118.447322236.89388947.573171580.583
103102469.231256276.923641107.692322215.38588861.538170892.308
104102468.571256274.286641097.143322194.28688777.143170217.143
105102467.925256271.698641086.792322173.58588694.340169554.717
106102467.290256269.159641076.636322153.27188613.084168904.673
107102466.667256266.667641066.667322133.33388533.333168266.667
108102466.055256264.220641056.881322113.76188455.046167640.367
109102465.455256261.818641047.273322094.54588378.182167025.455
110102464.865256259.459641037.838322075.67688302.703166421.622
111102464.286256257.143641028.571322057.14388228.571165828.571
112102463.717256254.867641019.469322038.93888155.752165246.018
113102463.158256252.632641010.526322021.05388084.211164673.684
114102462.609256250.435641001.739322003.47888013.913164111.304
115102462.069256248.27664993.103321986.20787944.828163558.621
116102461.538256246.15464984.615321969.23187876.923163015.385
117102461.017256244.06864976.271321952.54287810.169162481.356
118102460.504256242.01764968.067321936.13487744.538161956.303
1191024602562406496032192087680161440
120102459.504256238.01764952.066321904.13287616.529160932.231
121102459.016256236.06664944.262321888.52587554.098160432.787
122102458.537256234.14664936.585321873.17187492.683159941.463
123102458.065256232.25864929.032321858.06587432.258159458.065
124102457.600256230.40064921.600321843.20087372.800158982.400
125102457.143256228.57164914.286321828.57187314.286158514.286
126102456.693256226.77264907.087321814.17387256.693158053.543
127102456.2502562256490032180087200157600
128102455.814256223.25664893.023321786.04787144.186157153.488
129102455.385256221.53864886.154321772.30887089.231156713.846
130102454.962256219.84764879.389321758.77987035.115156280.916
131102454.545256218.18264872.727321745.45586981.818155854.545
132102454.135256216.54164866.165321732.33186929.323155434.586
133102453.731256214.92564859.701321719.40386877.612155020.896
134102453.333256213.33364853.333321706.66786826.667154613.333
135102452.941256211.76564847.059321694.11886776.471154211.765
136102452.555256210.21964840.876321681.75286727.007153816.058
137102452.174256208.69664834.783321669.56586678.261153426.087
138102451.799256207.19464828.777321657.55486630.216153041.727
139102451.429256205.71464822.857321645.71486582.857152662.857
140102451.064256204.25564817.021321634.04386536.170152289.362
141102450.704256202.81764811.268321622.53586490.141151921.127
142102450.350256201.39964805.594321611.18986444.755151558.042
1431024502562006480032160086400151200
144102449.655256198.62164794.483321588.96686355.862150846.897
145102449.315256197.26064789.041321578.08286312.329150498.630
146102448.980256195.91864783.673321567.34786269.388150155.102
147102448.649256194.59564778.378321556.75786227.027149816.216
148102448.322256193.28964773.154321546.30986185.235149481.879
1491024482561926476832153686144149152
150102447.682256190.72864762.914321525.82886103.311148826.490
151102447.368256189.47464757.895321515.78986063.158148505.263
152102447.059256188.23564752.941321505.88286023.529148188.235
153102446.753256187.01364748.052321496.10485984.416147875.325
154102446.452256185.80664743.226321486.45285945.806147566.452
155102446.154256184.61564738.462321476.92385907.692147261.538
156102445.860256183.43964733.758321467.51685870.064146960.510
157102445.570256182.27864729.114321458.22885832.911146663.291
158102445.283256181.13264724.528321449.05785796.226146369.811
1591024452561806472032144085760146080
160102444.720256178.88264715.528321431.05685724.224145793.789
161102444.444256177.77864711.111321422.22285688.889145511.111
162102444.172256176.68764706.748321413.49785653.988145231.902
163102443.902256175.61064702.439321404.87885619.512144956.098
164102443.636256174.54564698.182321396.36485585.455144683.636
165102443.373256173.49464693.976321387.95285551.807144414.458
166102443.114256172.45564689.820321379.64185518.563144148.503
167102442.857256171.42964685.714321371.42985485.714143885.714
168102442.604256170.41464681.657321363.31485453.254143626.036
169102442.353256169.41264677.647321355.29485421.176143369.412
170102442.105256168.42164673.684321347.36885389.474143115.789
171102441.860256167.44264669.767321339.53585358.140142865.116
172102441.618256166.47464665.896321331.79285327.168142617.341
173102441.379256165.51764662.069321324.13885296.552142372.414
174102441.143256164.57164658.286321316.57185266.286142130.286
175102440.909256163.63664654.545321309.09185236.364141890.909
176102440.678256162.71264650.847321301.69585206.780141654.237
177102440.449256161.79864647.191321294.38285177.528141420.225
178102440.223256160.89464643.575321287.15185148.603141188.827
1791024402561606464032128085120140960
180102439.779256159.11664636.464321272.92885091.713140733.702
181102439.560256158.24264632.967321265.93485063.736140509.890
182102439.344256157.37764629.508321259.01685036.066140288.525
183102439.130256156.52264626.087321252.17485008.696140069.565
184102438.919256155.67664622.703321245.40584981.622139852.973
185102438.710256154.83964619.355321238.71084954.839139638.710
186102438.503256154.01164616.043321232.08684928.342139426.738
187102438.298256153.19164612.766321225.53284902.128139217.021
188102438.095256152.38164609.524321219.04884876.190139009.524
189102437.895256151.57964606.316321212.63284850.526138804.211
190102437.696256150.78564603.141321206.28384825.131138601.047
191102437.5002561506460032120084800138400
192102437.306256149.22364596.891321193.78284775.130138201.036
193102437.113256148.45464593.814321187.62984750.515138004.124
194102436.923256147.69264590.769321181.53884726.154137809.231
195102436.735256146.93964587.755321175.51084702.041137616.327
196102436.548256146.19364584.772321169.54384678.173137425.381
197102436.364256145.45564581.818321163.63684654.545137236.364
198102436.181256144.72464578.894321157.78984631.156137049.246
1991024362561446457632115284608136864
200102435.821256143.28464573.134321146.26984585.075136680.597
201102435.644256142.57464570.297321140.59484562.376136499.010
202102435.468256141.87264567.488321134.97584539.901136319.212
203102435.294256141.17664564.706321129.41284517.647136141.176
204102435.122256140.48864561.951321123.90284495.610135964.878
205102434.951256139.80664559.223321118.44784473.786135790.291
206102434.783256139.13064556.522321113.04384452.174135617.391
207102434.615256138.46264553.846321107.69284430.769135446.154
208102434.450256137.79964551.196321102.39284409.569135276.555
209102434.286256137.14364548.571321097.14384388.571135108.571
210102434.123256136.49364545.972321091.94384367.773134942.180
211102433.962256135.84964543.396321086.79284347.170134777.358
212102433.803256135.21164540.845321081.69084326.761134614.085
213102433.645256134.57964538.318321076.63684306.542134452.336
214102433.488256133.95364535.814321071.62884286.512134292.093
215102433.333256133.33364533.333321066.66784266.667134133.333
216102433.180256132.71964530.876321061.75184247.005133976.037
217102433.028256132.11064528.440321056.88184227.523133820.183
218102432.877256131.50764526.027321052.05584208.219133665.753
219102432.727256130.90964523.636321047.27384189.091133512.727
220102432.579256130.31764521.267321042.53484170.136133361.086
221102432.432256129.73064518.919321037.83884151.351133210.811
222102432.287256129.14864516.592321033.18484132.735133061.883
223102432.143256128.57164514.286321028.57184114.286132914.286
2241024322561286451232102484096132768
225102431.858256127.43464509.735321019.46984077.876132623.009
226102431.718256126.87264507.489321014.97884059.912132479.295
227102431.579256126.31664505.263321010.52684042.105132336.842
228102431.441256125.76464503.057321006.11484024.454132195.633
229102431.304256125.21764500.870321001.73984006.957132055.652
230102431.169256124.67564498.70132997.40383989.610131916.883
231102431.034256124.13864496.55232993.10383972.414131779.310
232102430.901256123.60564494.42132988.84183955.365131642.918
233102430.769256123.07764492.30832984.61583938.462131507.692
234102430.638256122.55364490.21332980.42683921.702131373.617
235102430.508256122.03464488.13632976.27183905.085131240.678
236102430.380256121.51964486.07632972.15283888.608131108.861
237102430.252256121.00864484.03432968.06783872.269130978.151
238102430.126256120.50264482.00832964.01783856.067130848.536
239102430256120644803296083840130720
240102429.876256119.50264478.00832956.01783824.066130592.531
241102429.752256119.00864476.03332952.06683808.264130466.116
242102429.630256118.51964474.07432948.14883792.593130340.741
243102429.508256118.03364472.13132944.26283777.049130216.393
244102429.388256117.55164470.20432940.40883761.633130093.061
245102429.268256117.07364468.29332936.58583746.341129970.732
246102429.150256116.59964466.39732932.79483731.174129849.393
247102429.032256116.12964464.51632929.03283716.129129729.032
248102428.916256115.66364462.65132925.30183701.205129609.639
249102428.800256115.20064460.80032921.60083686.400129491.200
250102428.685256114.74164458.96432917.92883671.713129373.705
251102428.571256114.28664457.14332914.28683657.143129257.143
252102428.458256113.83464455.33632910.67283642.688129141.502
253102428.346256113.38664453.54332907.08783628.346129026.772
254102428.235256112.94164451.76532903.52983614.118128912.941
255102428.125256112.500644503290083600128800
w3cw3c
automatyka przemysłowa