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: 20000000 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
0102419531.25025678125643125003262500082500000120000000
110249765.62525639062.500641562503231250081250000110000000
210246510.41725626041.66764104166.66732208333.3338833333.33316666666.667
310244882.81225619531.250647812532156250862500015000000
410243906.25025615625646250032125000850000014000000
510243255.20825613020.8336452083.33332104166.6678416666.66713333333.333
610242790.17925611160.7146444642.8573289285.7148357142.85712857142.857
710242441.4062569765.6256439062.5003278125831250012500000
810242170.1392568680.5566434722.2223269444.4448277777.77812222222.222
910241953.1252567812.50064312503262500825000012000000
1010241775.5682567102.2736428409.0913256818.1828227272.72711818181.818
1110241627.6042566510.4176426041.6673252083.3338208333.33311666666.667
1210241502.4042566009.6156424038.4623248076.9238192307.69211538461.538
1310241395.0892565580.3576422321.4293244642.8578178571.42911428571.429
1410241302.0832565208.3336420833.3333241666.6678166666.66711333333.333
1510241220.7032564882.8126419531.2503239062.500815625011250000
1610241148.8972564595.5886418382.3533236764.7068147058.82411176470.588
1710241085.0692564340.2786417361.1113234722.2228138888.88911111111.111
1810241027.9612564111.8426416447.3683232894.7378131578.94711052631.579
191024976.5622563906.25064156253231250812500011000000
201024930.0602563720.2386414880.9523229761.9058119047.6191952380.952
211024887.7842563551.1366414204.5453228409.0918113636.3641909090.909
221024849.1852563396.7396413586.9573227173.9138108695.6521869565.217
231024813.8022563255.2086413020.8333226041.6678104166.6671833333.333
241024781.25025631256412500322500081000001800000
251024751.2022563004.8086412019.2313224038.462896153.8461769230.769
261024723.3802562893.5196411574.0743223148.148892592.5931740740.741
271024697.5452562790.1796411160.7143222321.429889285.7141714285.714
281024673.4912562693.9666410775.8623221551.724886206.8971689655.172
291024651.0422562604.1676410416.6673220833.333883333.3331666666.667
301024630.0402562520.1616410080.6453220161.290880645.1611645161.290
311024610.3522562441.406649765.6253219531.2508781251625000
321024591.8562562367.424649469.6973218939.394875757.5761606060.606
331024574.4492562297.794649191.1763218382.353873529.4121588235.294
341024558.0362562232.143648928.5713217857.143871428.5711571428.571
351024542.5352562170.139648680.5563217361.111869444.4441555555.556
361024527.8722562111.486648445.9463216891.892867567.5681540540.541
371024513.9802562055.921648223.6843216447.368865789.4741526315.789
381024500.8012562003.205648012.8213216025.641864102.5641512820.513
391024488.2812561953.125647812.50032156258625001500000
401024476.3722561905.488647621.9513215243.902860975.6101487804.878
411024465.0302561860.119647440.4763214880.952859523.8101476190.476
421024454.2152561816.860647267.4423214534.884858139.5351465116.279
431024443.8922561775.568647102.2733214204.545856818.1821454545.455
441024434.0282561736.111646944.4443213888.889855555.5561444444.444
451024424.5922561698.370646793.4783213586.957854347.8261434782.609
461024415.5592561662.234646648.9363213297.872853191.4891425531.915
471024406.9012561627.604646510.4173213020.833852083.3331416666.667
481024398.5972561594.388646377.5513212755.102851020.4081408163.265
491024390.6252561562.50064625032125008500001400000
501024382.9662561531.863646127.4513212254.902849019.6081392156.863
511024375.6012561502.404646009.6153212019.231848076.9231384615.385
521024368.5142561474.057645896.2263211792.453847169.8111377358.491
531024361.6902561446.759645787.0373211574.074846296.2961370370.370
541024355.1142561420.455645681.8183211363.636845454.5451363636.364
551024348.7722561395.089645580.3573211160.714844642.8571357142.857
561024342.6542561370.614645482.4563210964.912843859.6491350877.193
571024336.7462561346.983645387.9313210775.862843103.4481344827.586
581024331.0382561324.153645296.6103210593.220842372.8811338983.051
591024325.5212561302.083645208.3333210416.667841666.6671333333.333
601024320.1842561280.738645122.9513210245.902840983.6071327868.852
611024315.0202561260.081645040.3233210080.645840322.5811322580.645
621024310.0202561240.079644960.317329920.635839682.5401317460.317
631024305.1762561220.703644882.812329765.625839062.5001312500
641024300.4812561201.923644807.692329615.385838461.5381307692.308
651024295.9282561183.712644734.848329469.697837878.7881303030.303
661024291.5112561166.045644664.179329328.358837313.4331298507.463
671024287.2242561148.897644595.588329191.176836764.7061294117.647
681024283.0622561132.246644528.986329057.971836231.8841289855.072
691024279.0182561116.071644464.286328928.571835714.2861285714.286
701024275.0882561100.352644401.408328802.817835211.2681281690.141
711024271.2672561085.069644340.278328680.556834722.2221277777.778
721024267.5512561070.205644280.822328561.644834246.5751273972.603
731024263.9362561055.743644222.973328445.946833783.7841270270.270
741024260.4172561041.667644166.667328333.333833333.3331266666.667
751024256.9902561027.961644111.842328223.684832894.7371263157.895
761024253.6532561014.610644058.442328116.883832467.5321259740.260
771024250.4012561001.603644006.410328012.821832051.2821256410.256
781024247.231256988.924643955.696327911.392831645.5701253164.557
791024244.141256976.562643906.250327812.5008312501250000
801024241.127256964.506643858.025327716.049830864.1981246913.580
811024238.186256952.744643810.976327621.951830487.8051243902.439
821024235.316256941.265643765.060327530.120830120.4821240963.855
831024232.515256930.060643720.238327440.476829761.9051238095.238
841024229.779256919.118643676.471327352.941829411.7651235294.118
851024227.108256908.430643633.721327267.442829069.7671232558.140
861024224.497256897.989643591.954327183.908828735.6321229885.057
871024221.946256887.784643551.136327102.273828409.0911227272.727
881024219.452256877.809643511.236327022.472828089.8881224719.101
891024217.014256868.056643472.222326944.444827777.7781222222.222
901024214.629256858.516643434.066326868.132827472.5271219780.220
911024212.296256849.185643396.739326793.478827173.9131217391.304
921024210.013256840.054643360.215326720.430826881.7201215053.763
931024207.779256831.117643324.468326648.936826595.7451212765.957
941024205.592256822.368643289.474326578.947826315.7891210526.316
951024203.451256813.802643255.208326510.417826041.6671208333.333
961024201.353256805.412643221.649326443.299825773.1961206185.567
971024199.298256797.194643188.776326377.551825510.2041204081.633
981024197.285256789.141643156.566326313.131825252.5251202020.202
991024195.312256781.2506431253262508250001200000
1001024193.379256773.515643094.059326188.119824752.4751198019.802
1011024191.483256765.931643063.725326127.451824509.8041196078.431
1021024189.624256758.495643033.981326067.961824271.8451194174.757
1031024187.800256751.202643004.808326009.615824038.4621192307.692
1041024186.012256744.048642976.190325952.381823809.5241190476.190
1051024184.257256737.028642948.113325896.226823584.9061188679.245
1061024182.535256730.140642920.561325841.121823364.4861186915.888
1071024180.845256723.380642893.519325787.037823148.1481185185.185
1081024179.186256716.743642866.972325733.945822935.7801183486.239
1091024177.557256710.227642840.909325681.818822727.2731181818.182
1101024175.957256703.829642815.315325630.631822522.5231180180.180
1111024174.386256697.545642790.179325580.357822321.4291178571.429
1121024172.843256691.372642765.487325530.973822123.8941176991.150
1131024171.327256685.307642741.228325482.456821929.8251175438.596
1141024169.837256679.348642717.391325434.783821739.1301173913.043
1151024168.373256673.491642693.966325387.931821551.7241172413.793
1161024166.934256667.735642670.940325341.880821367.5211170940.171
1171024165.519256662.076642648.305325296.610821186.4411169491.525
1181024164.128256656.513642626.050325252.101821008.4031168067.227
1191024162.760256651.042642604.167325208.333820833.3331166666.667
1201024161.415256645.661642582.645325165.289820661.1571165289.256
1211024160.092256640.369642561.475325122.951820491.8031163934.426
1221024158.791256635.163642540.650325081.301820325.2031162601.626
1231024157.510256630.040642520.161325040.323820161.2901161290.323
1241024156.2502566256425003250008200001160000
1251024155.010256620.040642480.159324960.317819841.2701158730.159
1261024153.789256615.157642460.630324921.260819685.0391157480.315
1271024152.588256610.352642441.406324882.812819531.2501156250
1281024151.405256605.620642422.481324844.961819379.8451155038.760
1291024150.240256600.962642403.846324807.692819230.7691153846.154
1301024149.094256596.374642385.496324770.992819083.9691152671.756
1311024147.964256591.856642367.424324734.848818939.3941151515.152
1321024146.852256587.406642349.624324699.248818796.9921150375.940
1331024145.756256583.022642332.090324664.179818656.7161149253.731
1341024144.676256578.704642314.815324629.630818518.5191148148.148
1351024143.612256574.449642297.794324595.588818382.3531147058.824
1361024142.564256570.255642281.022324562.044818248.1751145985.401
1371024141.531256566.123642264.493324528.986818115.9421144927.536
1381024140.513256562.050642248.201324496.403817985.6121143884.892
1391024139.509256558.036642232.143324464.286817857.1431142857.143
1401024138.520256554.078642216.312324432.624817730.4961141843.972
1411024137.544256550.176642200.704324401.408817605.6341140845.070
1421024136.582256546.329642185.315324370.629817482.5171139860.140
1431024135.634256542.535642170.139324340.278817361.1111138888.889
1441024134.698256538.793642155.172324310.345817241.3791137931.034
1451024133.776256535.103642140.411324280.822817123.2881136986.301
1461024132.866256531.463642125.850324251.701817006.8031136054.422
1471024131.968256527.872642111.486324222.973816891.8921135135.135
1481024131.082256524.329642097.315324194.631816778.5231134228.188
1491024130.208256520.833642083.333324166.667816666.6671133333.333
1501024129.346256517.384642069.536324139.073816556.2911132450.331
1511024128.495256513.980642055.921324111.842816447.3681131578.947
1521024127.655256510.621642042.484324084.967816339.8691130718.954
1531024126.826256507.305642029.221324058.442816233.7661129870.130
1541024126.008256504.032642016.129324032.258816129.0321129032.258
1551024125.200256500.801642003.205324006.410816025.6411128205.128
1561024124.403256497.611641990.446323980.892815923.5671127388.535
1571024123.616256494.462641977.848323955.696815822.7851126582.278
1581024122.838256491.352641965.409323930.818815723.2701125786.164
1591024122.070256488.281641953.125323906.2508156251125000
1601024121.312256485.248641940.994323881.988815527.9501124223.602
1611024120.563256482.253641929.012323858.025815432.0991123456.790
1621024119.824256479.294641917.178323834.356815337.4231122699.387
1631024119.093256476.372641905.488323810.976815243.9021121951.220
1641024118.371256473.485641893.939323787.879815151.5151121212.121
1651024117.658256470.633641882.530323765.060815060.2411120481.928
1661024116.954256467.814641871.257323742.515814970.0601119760.479
1671024116.257256465.030641860.119323720.238814880.9521119047.619
1681024115.570256462.278641849.112323698.225814792.8991118343.195
1691024114.890256459.559641838.235323676.471814705.8821117647.059
1701024114.218256456.871641827.485323654.971814619.8831116959.064
1711024113.554256454.215641816.860323633.721814534.8841116279.070
1721024112.897256451.590641806.358323612.717814450.8671115606.936
1731024112.249256448.994641795.977323591.954814367.8161114942.529
1741024111.607256446.429641785.714323571.429814285.7141114285.714
1751024110.973256443.892641775.568323551.136814204.5451113636.364
1761024110.346256441.384641765.537323531.073814124.2941112994.350
1771024109.726256438.904641755.618323511.236814044.9441112359.551
1781024109.113256436.453641745.810323491.620813966.4801111731.844
1791024108.507256434.028641736.111323472.222813888.8891111111.111
1801024107.907256431.630641726.519323453.039813812.1551110497.238
1811024107.315256429.258641717.033323434.066813736.2641109890.110
1821024106.728256426.913641707.650323415.301813661.2021109289.617
1831024106.148256424.592641698.370323396.739813586.9571108695.652
1841024105.574256422.297641689.189323378.378813513.5141108108.108
1851024105.007256420.027641680.108323360.215813440.8601107526.882
1861024104.445256417.781641671.123323342.246813368.9841106951.872
1871024103.890256415.559641662.234323324.468813297.8721106382.979
1881024103.340256413.360641653.439323306.878813227.5131105820.106
1891024102.796256411.184641644.737323289.474813157.8951105263.158
1901024102.258256409.031641636.126323272.251813089.0051104712.042
1911024101.725256406.901641627.604323255.208813020.8331104166.667
1921024101.198256404.793641619.171323238.342812953.3681103626.943
1931024100.677256402.706641610.825323221.649812886.5981103092.784
1941024100.160256400.641641602.564323205.128812820.5131102564.103
195102499.649256398.597641594.388323188.776812755.1021102040.816
196102499.143256396.574641586.294323172.589812690.3551101522.843
197102498.643256394.571641578.283323156.566812626.2631101010.101
198102498.147256392.588641570.352323140.704812562.8141100502.513
199102497.656256390.625641562.5003231258125001100000
200102497.170256388.682641554.726323109.453812437.811199502.488
201102496.689256386.757641547.030323094.059812376.238199009.901
202102496.213256384.852641539.409323078.818812315.271198522.167
203102495.741256382.966641531.863323063.725812254.902198039.216
204102495.274256381.098641524.390323048.780812195.122197560.976
205102494.812256379.248641516.990323033.981812135.922197087.379
206102494.354256377.415641509.662323019.324812077.295196618.357
207102493.900256375.601641502.404323004.808812019.231196153.846
208102493.451256373.804641495.215322990.431811961.722195693.780
209102493.006256372.024641488.095322976.190811904.762195238.095
210102492.565256370.261641481.043322962.085811848.341194786.730
211102492.129256368.514641474.057322948.113811792.453194339.623
212102491.696256366.784641467.136322934.272811737.089193896.714
213102491.268256365.070641460.280322920.561811682.243193457.944
214102490.843256363.372641453.488322906.977811627.907193023.256
215102490.422256361.690641446.759322893.519811574.074192592.593
216102490.006256360.023641440.092322880.184811520.737192165.899
217102489.593256358.372641433.486322866.972811467.890191743.119
218102489.184256356.735641426.941322853.881811415.525191324.201
219102488.778256355.114641420.455322840.909811363.636190909.091
220102488.377256353.507641414.027322828.054811312.217190497.738
221102487.979256351.914641407.658322815.315811261.261190090.090
222102487.584256350.336641401.345322802.691811210.762189686.099
223102487.193256348.772641395.089322790.179811160.714189285.714
224102486.806256347.222641388.889322777.778811111.111188888.889
225102486.421256345.686641382.743322765.487811061.947188495.575
226102486.041256344.163641376.652322753.304811013.216188105.727
227102485.663256342.654641370.614322741.228810964.912187719.298
228102485.289256341.157641364.629322729.258810917.031187336.245
229102484.918256339.674641358.696322717.391810869.565186956.522
230102484.551256338.203641352.814322705.628810822.511186580.087
231102484.186256336.746641346.983322693.966810775.862186206.897
232102483.825256335.300641341.202322682.403810729.614185836.910
233102483.467256333.868641335.470322670.940810683.761185470.085
234102483.112256332.447641329.787322659.574810638.298185106.383
235102482.760256331.038641324.153322648.305810593.220184745.763
236102482.410256329.641641318.565322637.131810548.523184388.186
237102482.064256328.256641313.025322626.050810504.202184033.613
238102481.721256326.883641307.531322615.063810460.251183682.008
239102481.380256325.521641302.083322604.167810416.667183333.333
240102481.043256324.170641296.680322593.361810373.444182987.552
241102480.708256322.831641291.322322582.645810330.579182644.628
242102480.376256321.502641286.008322572.016810288.066182304.527
243102480.046256320.184641280.738322561.475810245.902181967.213
244102479.719256318.878641275.510322551.020810204.082181632.653
245102479.395256317.581641270.325322540.650810162.602181300.813
246102479.074256316.296641265.182322530.364810121.457180971.660
247102478.755256315.020641260.081322520.161810080.645180645.161
248102478.439256313.755641255.020322510.040810040.161180321.285
249102478.125256312.500641250322500810000180000
250102477.814256311.255641245.020322490.04089960.159179681.275
251102477.505256310.020641240.079322480.15989920.635179365.079
252102477.199256308.794641235.178322470.35689881.423179051.383
253102476.895256307.579641230.315322460.63089842.520178740.157
254102476.593256306.373641225.490322450.98089803.922178431.373
255102476.294256305.176641220.703322441.40689765.625178125
w3cw3c
automatyka przemysłowa