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: 16000000 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010241562525662500642500003250000082000000116000000
110247812.5002563125064125000322500008100000018000000
210245208.33325620833.3336483333.33332166666.6678666666.66715333333.333
310243906.25025615625646250032125000850000014000000
41024312525612500645000032100000840000013200000
510242604.16725610416.6676441666.6673283333.3338333333.33312666666.667
610242232.1432568928.5716435714.2863271428.5718285714.28612285714.286
710241953.1252567812.50064312503262500825000012000000
810241736.1112566944.4446427777.7783255555.5568222222.22211777777.778
910241562.500256625064250003250000820000011600000
1010241420.4552565681.8186422727.2733245454.5458181818.18211454545.455
1110241302.0832565208.3336420833.3333241666.6678166666.66711333333.333
1210241201.9232564807.6926419230.7693238461.5388153846.15411230769.231
1310241116.0712564464.2866417857.1433235714.2868142857.14311142857.143
1410241041.6672564166.6676416666.6673233333.3338133333.33311066666.667
151024976.5622563906.25064156253231250812500011000000
161024919.1182563676.4716414705.8823229411.7658117647.0591941176.471
171024868.0562563472.2226413888.8893227777.7788111111.1111888888.889
181024822.3682563289.4746413157.8953226315.7898105263.1581842105.263
191024781.25025631256412500322500081000001800000
201024744.0482562976.1906411904.7623223809.524895238.0951761904.762
211024710.2272562840.9096411363.6363222727.273890909.0911727272.727
221024679.3482562717.3916410869.5653221739.130886956.5221695652.174
231024651.0422562604.1676410416.6673220833.333883333.3331666666.667
2410246252562500641000032200008800001640000
251024600.9622562403.846649615.3853219230.769876923.0771615384.615
261024578.7042562314.815649259.2593218518.519874074.0741592592.593
271024558.0362562232.143648928.5713217857.143871428.5711571428.571
281024538.7932562155.172648620.6903217241.379868965.5171551724.138
291024520.8332562083.333648333.3333216666.667866666.6671533333.333
301024504.0322562016.129648064.5163216129.032864516.1291516129.032
311024488.2812561953.125647812.50032156258625001500000
321024473.4852561893.939647575.7583215151.515860606.0611484848.485
331024459.5592561838.235647352.9413214705.882858823.5291470588.235
341024446.4292561785.714647142.8573214285.714857142.8571457142.857
351024434.0282561736.111646944.4443213888.889855555.5561444444.444
361024422.2972561689.189646756.7573213513.514854054.0541432432.432
371024411.1842561644.737646578.9473213157.895852631.5791421052.632
381024400.6412561602.564646410.2563212820.513851282.0511410256.410
391024390.6252561562.50064625032125008500001400000
401024381.0982561524.390646097.5613212195.122848780.4881390243.902
411024372.0242561488.095645952.3813211904.762847619.0481380952.381
421024363.3722561453.488645813.9533211627.907846511.6281372093.023
431024355.1142561420.455645681.8183211363.636845454.5451363636.364
441024347.2222561388.889645555.5563211111.111844444.4441355555.556
451024339.6742561358.696645434.7833210869.565843478.2611347826.087
461024332.4472561329.787645319.1493210638.298842553.1911340425.532
471024325.5212561302.083645208.3333210416.667841666.6671333333.333
481024318.8782561275.510645102.0413210204.082840816.3271326530.612
491024312.500256125064500032100008400001320000
501024306.3732561225.490644901.961329803.922839215.6861313725.490
511024300.4812561201.923644807.692329615.385838461.5381307692.308
521024294.8112561179.245644716.981329433.962837735.8491301886.792
531024289.3522561157.407644629.630329259.259837037.0371296296.296
541024284.0912561136.364644545.455329090.909836363.6361290909.091
551024279.0182561116.071644464.286328928.571835714.2861285714.286
561024274.1232561096.491644385.965328771.930835087.7191280701.754
571024269.3972561077.586644310.345328620.690834482.7591275862.069
581024264.8312561059.322644237.288328474.576833898.3051271186.441
591024260.4172561041.667644166.667328333.333833333.3331266666.667
601024256.1482561024.590644098.361328196.721832786.8851262295.082
611024252.0162561008.065644032.258328064.516832258.0651258064.516
621024248.016256992.063643968.254327936.508831746.0321253968.254
631024244.141256976.562643906.250327812.5008312501250000
641024240.385256961.538643846.154327692.308830769.2311246153.846
651024236.742256946.970643787.879327575.758830303.0301242424.242
661024233.209256932.836643731.343327462.687829850.7461238805.970
671024229.779256919.118643676.471327352.941829411.7651235294.118
681024226.449256905.797643623.188327246.377828985.5071231884.058
691024223.214256892.857643571.429327142.857828571.4291228571.429
701024220.070256880.282643521.127327042.254828169.0141225352.113
711024217.014256868.056643472.222326944.444827777.7781222222.222
721024214.041256856.164643424.658326849.315827397.2601219178.082
731024211.149256844.595643378.378326756.757827027.0271216216.216
741024208.333256833.333643333.333326666.667826666.6671213333.333
751024205.592256822.368643289.474326578.947826315.7891210526.316
761024202.922256811.688643246.753326493.506825974.0261207792.208
771024200.321256801.282643205.128326410.256825641.0261205128.205
781024197.785256791.139643164.557326329.114825316.4561202531.646
791024195.312256781.2506431253262508250001200000
801024192.901256771.605643086.420326172.840824691.3581197530.864
811024190.549256762.195643048.780326097.561824390.2441195121.951
821024188.253256753.012643012.048326024.096824096.3861192771.084
831024186.012256744.048642976.190325952.381823809.5241190476.190
841024183.824256735.294642941.176325882.353823529.4121188235.294
851024181.686256726.744642906.977325813.953823255.8141186046.512
861024179.598256718.391642873.563325747.126822988.5061183908.046
871024177.557256710.227642840.909325681.818822727.2731181818.182
881024175.562256702.247642808.989325617.978822471.9101179775.281
891024173.611256694.444642777.778325555.556822222.2221177777.778
901024171.703256686.813642747.253325494.505821978.0221175824.176
911024169.837256679.348642717.391325434.783821739.1301173913.043
921024168.011256672.043642688.172325376.344821505.3761172043.011
931024166.223256664.894642659.574325319.149821276.5961170212.766
941024164.474256657.895642631.579325263.158821052.6321168421.053
951024162.760256651.042642604.167325208.333820833.3331166666.667
961024161.082256644.330642577.320325154.639820618.5571164948.454
971024159.439256637.755642551.020325102.041820408.1631163265.306
981024157.828256631.313642525.253325050.505820202.0201161616.162
991024156.2502566256425003250008200001160000
1001024154.703256618.812642475.248324950.495819801.9801158415.842
1011024153.186256612.745642450.980324901.961819607.8431156862.745
1021024151.699256606.796642427.184324854.369819417.4761155339.806
1031024150.240256600.962642403.846324807.692819230.7691153846.154
1041024148.810256595.238642380.952324761.905819047.6191152380.952
1051024147.406256589.623642358.491324716.981818867.9251150943.396
1061024146.028256584.112642336.449324672.897818691.5891149532.710
1071024144.676256578.704642314.815324629.630818518.5191148148.148
1081024143.349256573.394642293.578324587.156818348.6241146788.991
1091024142.045256568.182642272.727324545.455818181.8181145454.545
1101024140.766256563.063642252.252324504.505818018.0181144144.144
1111024139.509256558.036642232.143324464.286817857.1431142857.143
1121024138.274256553.097642212.389324424.779817699.1151141592.920
1131024137.061256548.246642192.982324385.965817543.8601140350.877
1141024135.870256543.478642173.913324347.826817391.3041139130.435
1151024134.698256538.793642155.172324310.345817241.3791137931.034
1161024133.547256534.188642136.752324273.504817094.0171136752.137
1171024132.415256529.661642118.644324237.288816949.1531135593.220
1181024131.303256525.210642100.840324201.681816806.7231134453.782
1191024130.208256520.833642083.333324166.667816666.6671133333.333
1201024129.132256516.529642066.116324132.231816528.9261132231.405
1211024128.074256512.295642049.180324098.361816393.4431131147.541
1221024127.033256508.130642032.520324065.041816260.1631130081.301
1231024126.008256504.032642016.129324032.258816129.0321129032.258
12410241252565006420003240008160001128000
1251024124.008256496.032641984.127323968.254815873.0161126984.127
1261024123.031256492.126641968.504323937.008815748.0311125984.252
1271024122.070256488.281641953.125323906.2508156251125000
1281024121.124256484.496641937.984323875.969815503.8761124031.008
1291024120.192256480.769641923.077323846.154815384.6151123076.923
1301024119.275256477.099641908.397323816.794815267.1761122137.405
1311024118.371256473.485641893.939323787.879815151.5151121212.121
1321024117.481256469.925641879.699323759.398815037.5941120300.752
1331024116.604256466.418641865.672323731.343814925.3731119402.985
1341024115.741256462.963641851.852323703.704814814.8151118518.519
1351024114.890256459.559641838.235323676.471814705.8821117647.059
1361024114.051256456.204641824.818323649.635814598.5401116788.321
1371024113.225256452.899641811.594323623.188814492.7541115942.029
1381024112.410256449.640641798.561323597.122814388.4891115107.914
1391024111.607256446.429641785.714323571.429814285.7141114285.714
1401024110.816256443.262641773.050323546.099814184.3971113475.177
1411024110.035256440.141641760.563323521.127814084.5071112676.056
1421024109.266256437.063641748.252323496.503813986.0141111888.112
1431024108.507256434.028641736.111323472.222813888.8891111111.111
1441024107.759256431.034641724.138323448.276813793.1031110344.828
1451024107.021256428.082641712.329323424.658813698.6301109589.041
1461024106.293256425.170641700.680323401.361813605.4421108843.537
1471024105.574256422.297641689.189323378.378813513.5141108108.108
1481024104.866256419.463641677.852323355.705813422.8191107382.550
1491024104.167256416.667641666.667323333.333813333.3331106666.667
1501024103.477256413.907641655.629323311.258813245.0331105960.265
1511024102.796256411.184641644.737323289.474813157.8951105263.158
1521024102.124256408.497641633.987323267.974813071.8951104575.163
1531024101.461256405.844641623.377323246.753812987.0131103896.104
1541024100.806256403.226641612.903323225.806812903.2261103225.806
1551024100.160256400.641641602.564323205.128812820.5131102564.103
156102499.522256398.089641592.357323184.713812738.8541101910.828
157102498.892256395.570641582.278323164.557812658.2281101265.823
158102498.270256393.082641572.327323144.654812578.6161100628.931
159102497.656256390.625641562.5003231258125001100000
160102497.050256388.199641552.795323105.590812422.360199378.882
161102496.451256385.802641543.210323086.420812345.679198765.432
162102495.859256383.436641533.742323067.485812269.939198159.509
163102495.274256381.098641524.390323048.780812195.122197560.976
164102494.697256378.788641515.152323030.303812121.212196969.697
165102494.127256376.506641506.024323012.048812048.193196385.542
166102493.563256374.251641497.006322994.012811976.048195808.383
167102493.006256372.024641488.095322976.190811904.762195238.095
168102492.456256369.822641479.290322958.580811834.320194674.556
169102491.912256367.647641470.588322941.176811764.706194117.647
170102491.374256365.497641461.988322923.977811695.906193567.251
171102490.843256363.372641453.488322906.977811627.907193023.256
172102490.318256361.272641445.087322890.173811560.694192485.549
173102489.799256359.195641436.782322873.563811494.253191954.023
174102489.286256357.143641428.571322857.143811428.571191428.571
175102488.778256355.114641420.455322840.909811363.636190909.091
176102488.277256353.107641412.429322824.859811299.435190395.480
177102487.781256351.124641404.494322808.989811235.955189887.640
178102487.291256349.162641396.648322793.296811173.184189385.475
179102486.806256347.222641388.889322777.778811111.111188888.889
180102486.326256345.304641381.215322762.431811049.724188397.790
181102485.852256343.407641373.626322747.253810989.011187912.088
182102485.383256341.530641366.120322732.240810928.962187431.694
183102484.918256339.674641358.696322717.391810869.565186956.522
184102484.459256337.838641351.351322702.703810810.811186486.486
185102484.005256336.022641344.086322688.172810752.688186021.505
186102483.556256334.225641336.898322673.797810695.187185561.497
187102483.112256332.447641329.787322659.574810638.298185106.383
188102482.672256330.688641322.751322645.503810582.011184656.085
189102482.237256328.947641315.789322631.579810526.316184210.526
190102481.806256327.225641308.901322617.801810471.204183769.634
191102481.380256325.521641302.083322604.167810416.667183333.333
192102480.959256323.834641295.337322590.674810362.694182901.554
193102480.541256322.165641288.660322577.320810309.278182474.227
194102480.128256320.513641282.051322564.103810256.410182051.282
195102479.719256318.878641275.510322551.020810204.082181632.653
196102479.315256317.259641269.036322538.071810152.284181218.274
197102478.914256315.657641262.626322525.253810101.010180808.081
198102478.518256314.070641256.281322512.563810050.251180402.010
199102478.125256312.500641250322500810000180000
200102477.736256310.945641243.781322487.56289950.249179601.990
201102477.351256309.406641237.624322475.24889900.990179207.921
202102476.970256307.882641231.527322463.05489852.217178817.734
203102476.593256306.373641225.490322450.98089803.922178431.373
204102476.220256304.878641219.512322439.02489756.098178048.780
205102475.850256303.398641213.592322427.18489708.738177669.903
206102475.483256301.932641207.729322415.45989661.836177294.686
207102475.120256300.481641201.923322403.84689615.385176923.077
208102474.761256299.043641196.172322392.34489569.378176555.024
209102474.405256297.619641190.476322380.95289523.810176190.476
210102474.052256296.209641184.834322369.66889478.673175829.384
211102473.703256294.811641179.245322358.49189433.962175471.698
212102473.357256293.427641173.709322347.41889389.671175117.371
213102473.014256292.056641168.224322336.44989345.794174766.355
214102472.674256290.698641162.791322325.58189302.326174418.605
215102472.338256289.352641157.407322314.81589259.259174074.074
216102472.005256288.018641152.074322304.14789216.590173732.719
217102471.674256286.697641146.789322293.57889174.312173394.495
218102471.347256285.388641141.553322283.10589132.420173059.361
219102471.023256284.091641136.364322272.72789090.909172727.273
220102470.701256282.805641131.222322262.44389049.774172398.190
221102470.383256281.532641126.126322252.25289009.009172072.072
222102470.067256280.269641121.076322242.15288968.610171748.879
223102469.754256279.018641116.071322232.14388928.571171428.571
224102469.444256277.778641111.111322222.22288888.889171111.111
225102469.137256276.549641106.195322212.38988849.558170796.460
226102468.833256275.330641101.322322202.64388810.573170484.581
227102468.531256274.123641096.491322192.98288771.930170175.439
228102468.231256272.926641091.703322183.40688733.624169868.996
229102467.935256271.739641086.957322173.91388695.652169565.217
230102467.641256270.563641082.251322164.50288658.009169264.069
231102467.349256269.397641077.586322155.17288620.690168965.517
232102467.060256268.240641072.961322145.92388583.691168669.528
233102466.774256267.094641068.376322136.75288547.009168376.068
234102466.489256265.957641063.830322127.66088510.638168085.106
235102466.208256264.831641059.322322118.64488474.576167796.610
236102465.928256263.713641054.852322109.70588438.819167510.549
237102465.651256262.605641050.420322100.84088403.361167226.891
238102465.377256261.506641046.025322092.05088368.201166945.607
239102465.104256260.417641041.667322083.33388333.333166666.667
240102464.834256259.336641037.344322074.68988298.755166390.041
241102464.566256258.264641033.058322066.11688264.463166115.702
242102464.300256257.202641028.807322057.61388230.453165843.621
243102464.037256256.148641024.590322049.18088196.721165573.770
244102463.776256255.102641020.408322040.81688163.265165306.122
245102463.516256254.065641016.260322032.52088130.081165040.650
246102463.259256253.036641012.146322024.29188097.166164777.328
247102463.004256252.016641008.065322016.12988064.516164516.129
248102462.751256251.004641004.016322008.03288032.129164257.028
249102462.50025625064100032200088000164000
250102462.251256249.00464996.016321992.03287968.127163745.020
251102462.004256248.01664992.063321984.12787936.508163492.063
252102461.759256247.03664988.142321976.28587905.138163241.107
253102461.516256246.06364984.252321968.50487874.016162992.126
254102461.275256245.09864980.392321960.78487843.137162745.098
255102461.035256244.14164976.562321953.12587812.500162500
w3cw3c
automatyka przemysłowa