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: 14745600 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010241440025657600642304003246080081843200114745600
110247200256288006411520032230400892160017372800
21024480025619200647680032153600861440014915200
31024360025614400645760032115200846080013686400
4102428802561152064460803292160836864012949120
510242400256960064384003276800830720012457600
610242057.1432568228.5716432914.2863265828.5718263314.28612106514.286
710241800256720064288003257600823040011843200
810241600256640064256003251200820480011638400
910241440256576064230403246080818432011474560
1010241309.0912565236.3646420945.4553241890.9098167563.63611340509.091
1110241200256480064192003238400815360011228800
1210241107.6922564430.7696417723.0773235446.1548141784.61511134276.923
1310241028.5712564114.2866416457.1433232914.2868131657.14311053257.143
14102496025638406415360323072081228801983040
15102490025636006414400322880081152001921600
161024847.0592563388.2356413552.9413227105.8828108423.5291867388.235
17102480025632006412800322560081024001819200
181024757.8952563031.5796412126.3163224252.632897010.5261776084.211
1910247202562880641152032230408921601737280
201024685.7142562742.8576410971.4293221942.857887771.4291702171.429
211024654.5452562618.1826410472.7273220945.455883781.8181670254.545
221024626.0872562504.3486410017.3913220034.783880139.1301641113.043
231024600256240064960032192008768001614400
241024576256230464921632184328737281589824
251024553.8462562215.385648861.5383217723.077870892.3081567138.462
261024533.3332562133.333648533.3333217066.667868266.6671546133.333
271024514.2862562057.143648228.5713216457.143865828.5711526628.571
281024496.5522561986.207647944.8283215889.655863558.6211508468.966
291024480256192064768032153608614401491520
301024464.5162561858.065647432.2583214864.516859458.0651475664.516
311024450256180064720032144008576001460800
321024436.3642561745.455646981.8183213963.636855854.5451446836.364
331024423.5292561694.118646776.4713213552.941854211.7651433694.118
341024411.4292561645.714646582.8573213165.714852662.8571421302.857
351024400256160064640032128008512001409600
361024389.1892561556.757646227.0273212454.054849816.2161398529.730
371024378.9472561515.789646063.1583212126.316848505.2631388042.105
381024369.2312561476.923645907.6923211815.385847261.5381378092.308
391024360256144064576032115208460801368640
401024351.2202561404.878645619.5123211239.024844956.0981359648.780
411024342.8572561371.429645485.7143210971.429843885.7141351085.714
421024334.8842561339.535645358.1403210716.279842865.1161342920.930
431024327.2732561309.091645236.3643210472.727841890.9091335127.273
441024320256128064512032102408409601327680
451024313.0432561252.174645008.6963210017.391840069.5651320556.522
461024306.3832561225.532644902.128329804.255839217.0211313736.170
47102430025612006448003296008384001307200
481024293.8782561175.510644702.041329404.082837616.3271300930.612
49102428825611526446083292168368641294912
501024282.3532561129.412644517.647329035.294836141.1761289129.412
511024276.9232561107.692644430.769328861.538835446.1541283569.231
521024271.6982561086.792644347.170328694.340834777.3581278218.868
531024266.6672561066.667644266.667328533.333834133.3331273066.667
541024261.8182561047.273644189.091328378.182833512.7271268101.818
551024257.1432561028.571644114.286328228.571832914.2861263314.286
561024252.6322561010.526644042.105328084.211832336.8421258694.737
571024248.276256993.103643972.414327944.828831779.3101254234.483
581024244.068256976.271643905.085327810.169831240.6781249925.424
5910242402569606438403276808307201245760
601024236.066256944.262643777.049327554.098830216.3931241731.148
611024232.258256929.032643716.129327432.258829729.0321237832.258
621024228.571256914.286643657.143327314.286829257.1431234057.143
6310242252569006436003272008288001230400
641024221.538256886.154643544.615327089.231828356.9231226855.385
651024218.182256872.727643490.909326981.818827927.2731223418.182
661024214.925256859.701643438.806326877.612827510.4481220083.582
671024211.765256847.059643388.235326776.471827105.8821216847.059
681024208.696256834.783643339.130326678.261826713.0431213704.348
691024205.714256822.857643291.429326582.857826331.4291210651.429
701024202.817256811.268643245.070326490.141825960.5631207684.507
7110242002568006432003264008256001204800
721024197.260256789.041643156.164326312.329825249.3151201994.521
731024194.595256778.378643113.514326227.027824908.1081199264.865
7410241922567686430723261448245761196608
751024189.474256757.895643031.579326063.158824252.6321194021.053
761024187.013256748.052642992.208325984.416823937.6621191501.299
771024184.615256738.462642953.846325907.692823630.7691189046.154
781024182.278256729.114642916.456325832.911823331.6461186653.165
7910241802567206428803257608230401184320
801024177.778256711.111642844.444325688.889822755.5561182044.444
811024175.610256702.439642809.756325619.512822478.0491179824.390
821024173.494256693.976642775.904325551.807822207.2291177657.831
831024171.429256685.714642742.857325485.714821942.8571175542.857
841024169.412256677.647642710.588325421.176821684.7061173477.647
851024167.442256669.767642679.070325358.140821432.5581171460.465
861024165.517256662.069642648.276325296.552821186.2071169489.655
871024163.636256654.545642618.182325236.364820945.4551167563.636
881024161.798256647.191642588.764325177.528820710.1121165680.899
8910241602566406425603251208204801163840
901024158.242256632.967642531.868325063.736820254.9451162039.560
911024156.522256626.087642504.348325008.696820034.7831160278.261
921024154.839256619.355642477.419324954.839819819.3551158554.839
931024153.191256612.766642451.064324902.128819608.5111156868.085
941024151.579256606.316642425.263324850.526819402.1051155216.842
9510241502566006424003248008192001153600
961024148.454256593.814642375.258324750.515819002.0621152016.495
971024146.939256587.755642351.020324702.041818808.1631150465.306
981024145.455256581.818642327.273324654.545818618.1821148945.455
9910241442565766423043246088184321147456
1001024142.574256570.297642281.188324562.376818249.5051145996.040
1011024141.176256564.706642258.824324517.647818070.5881144564.706
1021024139.806256559.223642236.893324473.786817895.1461143161.165
1031024138.462256553.846642215.385324430.769817723.0771141784.615
1041024137.143256548.571642194.286324388.571817554.2861140434.286
1051024135.849256543.396642173.585324347.170817388.6791139109.434
1061024134.579256538.318642153.271324306.542817226.1681137809.346
1071024133.333256533.333642133.333324266.667817066.6671136533.333
1081024132.110256528.440642113.761324227.523816910.0921135280.734
1091024130.909256523.636642094.545324189.091816756.3641134050.909
1101024129.730256518.919642075.676324151.351816605.4051132843.243
1111024128.571256514.286642057.143324114.286816457.1431131657.143
1121024127.434256509.735642038.938324077.876816311.5041130492.035
1131024126.316256505.263642021.053324042.105816168.4211129347.368
1141024125.217256500.870642003.478324006.957816027.8261128222.609
1151024124.138256496.552641986.207323972.414815889.6551127117.241
1161024123.077256492.308641969.231323938.462815753.8461126030.769
1171024122.034256488.136641952.542323905.085815620.3391124962.712
1181024121.008256484.034641936.134323872.269815489.0761123912.605
11910241202564806419203238408153601122880
1201024119.008256476.033641904.132323808.264815233.0581121864.463
1211024118.033256472.131641888.525323777.049815108.1971120865.574
1221024117.073256468.293641873.171323746.341814985.3661119882.927
1231024116.129256464.516641858.065323716.129814864.5161118916.129
1241024115.200256460.800641843.200323686.400814745.6001117964.800
1251024114.286256457.143641828.571323657.143814628.5711117028.571
1261024113.386256453.543641814.173323628.346814513.3861116107.087
1271024112.5002564506418003236008144001115200
1281024111.628256446.512641786.047323572.093814288.3721114306.977
1291024110.769256443.077641772.308323544.615814178.4621113427.692
1301024109.924256439.695641758.779323517.557814070.2291112561.832
1311024109.091256436.364641745.455323490.909813963.6361111709.091
1321024108.271256433.083641732.331323464.662813858.6471110869.173
1331024107.463256429.851641719.403323438.806813755.2241110041.791
1341024106.667256426.667641706.667323413.333813653.3331109226.667
1351024105.882256423.529641694.118323388.235813552.9411108423.529
1361024105.109256420.438641681.752323363.504813454.0151107632.117
1371024104.348256417.391641669.565323339.130813356.5221106852.174
1381024103.597256414.388641657.554323315.108813260.4321106083.453
1391024102.857256411.429641645.714323291.429813165.7141105325.714
1401024102.128256408.511641634.043323268.085813072.3401104578.723
1411024101.408256405.634641622.535323245.070812980.2821103842.254
1421024100.699256402.797641611.189323222.378812889.5101103116.084
14310241002564006416003232008128001102400
144102499.310256397.241641588.966323177.931812711.7241101693.793
145102498.630256394.521641578.082323156.164812624.6581100997.260
146102497.959256391.837641567.347323134.694812538.7761100310.204
147102497.297256389.189641556.757323113.514812454.054199632.432
148102496.644256386.577641546.309323092.617812370.470198963.758
149102496256384641536323072812288198304
150102495.364256381.457641525.828323051.656812206.623197652.980
151102494.737256378.947641515.789323031.579812126.316197010.526
152102494.118256376.471641505.882323011.765812047.059196376.471
153102493.506256374.026641496.104322992.208811968.831195750.649
154102492.903256371.613641486.452322972.903811891.613195132.903
155102492.308256369.231641476.923322953.846811815.385194523.077
156102491.720256366.879641467.516322935.032811740.127193921.019
157102491.139256364.557641458.228322916.456811665.823193326.582
158102490.566256362.264641449.057322898.113811592.453192739.623
159102490256360641440322880811520192160
160102489.441256357.764641431.056322862.112811448.447191587.578
161102488.889256355.556641422.222322844.444811377.778191022.222
162102488.344256353.374641413.497322826.994811307.975190463.804
163102487.805256351.220641404.878322809.756811239.024189912.195
164102487.273256349.091641396.364322792.727811170.909189367.273
165102486.747256346.988641387.952322775.904811103.614188828.916
166102486.228256344.910641379.641322759.281811037.126188297.006
167102485.714256342.857641371.429322742.857810971.429187771.429
168102485.207256340.828641363.314322726.627810906.509187252.071
169102484.706256338.824641355.294322710.588810842.353186738.824
170102484.211256336.842641347.368322694.737810778.947186231.579
171102483.721256334.884641339.535322679.070810716.279185730.233
172102483.237256332.948641331.792322663.584810654.335185234.682
173102482.759256331.034641324.138322648.276810593.103184744.828
174102482.286256329.143641316.571322633.143810532.571184260.571
175102481.818256327.273641309.091322618.182810472.727183781.818
176102481.356256325.424641301.695322603.390810413.559183308.475
177102480.899256323.596641294.382322588.764810355.056182840.449
178102480.447256321.788641287.151322574.302810297.207182377.654
179102480256320641280322560810240181920
180102479.558256318.232641272.928322545.856810183.425181467.403
181102479.121256316.484641265.934322531.868810127.473181019.780
182102478.689256314.754641259.016322518.033810072.131180577.049
183102478.261256313.043641252.174322504.348810017.391180139.130
184102477.838256311.351641245.405322490.81189963.243179705.946
185102477.419256309.677641238.710322477.41989909.677179277.419
186102477.005256308.021641232.086322464.17189856.684178853.476
187102476.596256306.383641225.532322451.06489804.255178434.043
188102476.190256304.762641219.048322438.09589752.381178019.048
189102475.789256303.158641212.632322425.26389701.053177608.421
190102475.393256301.571641206.283322412.56589650.262177202.094
19110247525630064120032240089600176800
192102474.611256298.446641193.782322387.56589550.259176402.073
193102474.227256296.907641187.629322375.25889501.031176008.247
194102473.846256295.385641181.538322363.07789452.308175618.462
195102473.469256293.878641175.510322351.02089404.082175232.653
196102473.096256292.386641169.543322339.08689356.345174850.761
197102472.727256290.909641163.636322327.27389309.091174472.727
198102472.362256289.447641157.789322315.57889262.312174098.492
19910247225628864115232230489216173728
200102471.642256286.567641146.269322292.53789170.149173361.194
201102471.287256285.149641140.594322281.18889124.752172998.020
202102470.936256283.744641134.975322269.95189079.803172638.424
203102470.588256282.353641129.412322258.82489035.294172282.353
204102470.244256280.976641123.902322247.80588991.220171929.756
205102469.903256279.612641118.447322236.89388947.573171580.583
206102469.565256278.261641113.043322226.08788904.348171234.783
207102469.231256276.923641107.692322215.38588861.538170892.308
208102468.900256275.598641102.392322204.78588819.139170553.110
209102468.571256274.286641097.143322194.28688777.143170217.143
210102468.246256272.986641091.943322183.88688735.545169884.360
211102467.925256271.698641086.792322173.58588694.340169554.717
212102467.606256270.423641081.690322163.38088653.521169228.169
213102467.290256269.159641076.636322153.27188613.084168904.673
214102466.977256267.907641071.628322143.25688573.023168584.186
215102466.667256266.667641066.667322133.33388533.333168266.667
216102466.359256265.438641061.751322123.50288494.009167952.074
217102466.055256264.220641056.881322113.76188455.046167640.367
218102465.753256263.014641052.055322104.11088416.438167331.507
219102465.455256261.818641047.273322094.54588378.182167025.455
220102465.158256260.633641042.534322085.06888340.271166722.172
221102464.865256259.459641037.838322075.67688302.703166421.622
222102464.574256258.296641033.184322066.36888265.471166123.767
223102464.286256257.143641028.571322057.14388228.571165828.571
22410246425625664102432204888192165536
225102463.717256254.867641019.469322038.93888155.752165246.018
226102463.436256253.744641014.978322029.95688119.824164958.590
227102463.158256252.632641010.526322021.05388084.211164673.684
228102462.882256251.528641006.114322012.22788048.908164391.266
229102462.609256250.435641001.739322003.47888013.913164111.304
230102462.338256249.35164997.403321994.80587979.221163833.766
231102462.069256248.27664993.103321986.20787944.828163558.621
232102461.803256247.21064988.841321977.68287910.730163285.837
233102461.538256246.15464984.615321969.23187876.923163015.385
234102461.277256245.10664980.426321960.85187843.404162747.234
235102461.017256244.06864976.271321952.54287810.169162481.356
236102460.759256243.03864972.152321944.30487777.215162217.722
237102460.504256242.01764968.067321936.13487744.538161956.303
238102460.251256241.00464964.017321928.03387712.134161697.071
2391024602562406496032192087680161440
240102459.751256239.00464956.017321912.03387648.133161185.062
241102459.504256238.01764952.066321904.13287616.529160932.231
242102459.259256237.03764948.148321896.29687585.185160681.481
243102459.016256236.06664944.262321888.52587554.098160432.787
244102458.776256235.10264940.408321880.81687523.265160186.122
245102458.537256234.14664936.585321873.17187492.683159941.463
246102458.300256233.19864932.794321865.58787462.348159698.785
247102458.065256232.25864929.032321858.06587432.258159458.065
248102457.831256231.32564925.301321850.60287402.410159219.277
249102457.600256230.40064921.600321843.20087372.800158982.400
250102457.371256229.48264917.928321835.85787343.426158747.410
251102457.143256228.57164914.286321828.57187314.286158514.286
252102456.917256227.66864910.672321821.34487285.375158283.004
253102456.693256226.77264907.087321814.17387256.693158053.543
254102456.471256225.88264903.529321807.05987228.235157825.882
255102456.2502562256490032180087200157600
w3cw3c
automatyka przemysłowa