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: 8867238 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010248659.41225634637.64864138550.59432277101.18881108404.75018867238
110244329.70625617318.8246469275.29732138550.5948554202.37514433619
210242886.47125611545.8836446183.5313292367.0628369468.25012955746
310242164.8532568659.4126434637.6483269275.2978277101.18812216809.500
410241731.8822566927.5306427710.1193255420.2388221680.95011773447.600
510241443.2352565772.9416423091.7663246183.5318184734.12511477873
610241237.0592564948.2356419792.9423239585.8848158343.53611266748.286
710241082.4272564329.7066417318.8243234637.6488138550.59411108404.750
81024962.1572563848.6286415394.5103230789.0218123156.0831985248.667
91024865.9412563463.7656413855.0593227710.1198110840.4751886723.800
101024787.2192563148.8776412595.5093225191.0178100764.0681806112.545
111024721.6182562886.4716411545.8833223091.766892367.0621738936.500
121024666.1092562664.4346410657.7383221315.476885261.9041682095.231
131024618.5292562474.118649896.4713219792.942879171.7681633374.143
141024577.2942562309.177649236.7063218473.412873893.6501591149.200
151024541.2132562164.853648659.4123217318.824869275.2971554202.375
161024509.3772562037.509648150.0353216300.070865200.2791521602.235
171024481.0782561924.314647697.2553215394.510861578.0421492624.333
181024455.7592561823.034647292.1373214584.273858337.0921466696.737
191024432.9712561731.882646927.5303213855.059855420.2381443361.900
201024412.3532561649.412646597.6473213195.295852781.1791422249.429
211024393.6102561574.439646297.7543212595.509850382.0341403056.273
221024376.4962561505.985646023.9393212047.878848191.5111385532.087
231024360.8092561443.235645772.9413211545.883846183.5311369468.250
241024346.3762561385.506645542.0243211084.048844336.1901354689.520
251024333.0542561332.217645328.8693210657.738842630.9521341047.615
261024320.7192561282.876645131.5033210263.007841052.0281328416.222
271024309.2652561237.059644948.235329896.471839585.8841316687.071
281024298.6002561194.402644777.607329555.213838220.8531305766.828
291024288.6472561154.588644618.353329236.706836946.8251295574.600
301024279.3362561117.343644469.374328938.748835754.9921286039.935
311024270.6072561082.427644329.706328659.412834637.6481277101.188
321024262.4062561049.626644198.503328397.006833588.0231268704.182
331024254.6892561018.754644075.017328150.035832600.1401260801.118
341024247.412256989.647643958.588327917.177831668.7071253349.657
351024240.539256962.157643848.628327697.255830789.0211246312.167
361024234.038256936.153643744.611327489.221829956.8851239655.081
371024227.879256911.517643646.068327292.137829168.5461233348.368
381024222.036256888.145643552.579327105.159828420.6351227365.077
391024216.485256865.941643463.765326927.530827710.1191221680.950
401024211.205256844.821643379.283326758.566827034.2621216274.098
411024206.176256824.706643298.824326597.647826390.5891211124.714
421024201.382256805.527643222.107326444.214825776.8551206214.837
431024196.805256787.219643148.877326297.754825191.0171201528.136
441024192.431256769.726643078.902326157.804824631.2171197049.733
451024188.248256752.992643011.969326023.939824095.7551192766.043
461024184.243256736.971642947.885325895.770823583.0801188664.638
471024180.404256721.618642886.471325772.941823091.7661184734.125
481024176.723256706.891642827.563325655.126822620.5051180964.041
491024173.188256692.753642771.012325542.024822168.0951177344.760
501024169.792256679.170642716.678325433.357821733.4261173867.412
511024166.527256666.109642664.434325328.869821315.4761170523.808
521024163.385256653.541642614.162325228.324820913.2971167306.377
531024160.359256641.438642565.752325131.503820526.0141164208.111
541024157.444256629.775642519.102325038.203820152.8141161222.509
551024154.632256618.529642474.118324948.235819792.9421158343.536
561024151.920256607.678642430.712324861.424819445.6971155565.579
571024149.300256597.201642388.803324777.607819110.4271152883.414
581024146.770256587.079642348.315324696.630818786.5211150292.169
591024144.324256577.294642309.177324618.353818473.4121147787.300
601024141.958256567.830642271.321324542.642818170.5701145364.557
611024139.668256558.672642234.687324469.374817877.4961143019.968
621024137.451256549.804642199.216324398.432817593.7261140749.810
631024135.303256541.213642164.853324329.706817318.8241138550.594
641024133.222256532.887642131.548324263.095817052.3811136419.046
651024131.203256524.813642099.251324198.503816794.0111134352.091
661024129.245256516.980642067.919324135.839816543.3541132346.836
671024127.344256509.377642037.509324075.017816300.0701130400.559
681024125.499256501.995642007.980324015.959816063.8371128510.696
691024123.706256494.824641979.294323958.588815834.3541126674.829
701024121.964256487.854641951.417323902.834815611.3351124890.676
711024120.270256481.078641924.314323848.628815394.5101123156.083
721024118.622256474.488641897.953323795.907815183.6271121469.014
731024117.019256468.076641872.305323744.611814978.4431119827.541
741024115.459256461.835641847.341323694.682814778.7301118229.840
751024113.940256455.759641823.034323646.068814584.2731116674.184
761024112.460256449.840641799.358323598.717814394.8671115158.935
771024111.018256444.072641776.290323552.579814210.3171113682.538
781024109.613256438.451641753.805323507.610814030.4401112243.519
791024108.243256432.971641731.882323463.765813855.0591110840.475
801024106.906256427.625641710.501323421.002813684.0091109472.074
811024105.603256422.410641689.641323379.283813517.1311108137.049
821024104.330256417.321641669.284323338.569813354.2741106834.193
831024103.088256412.353641649.412323298.824813195.2951105562.357
841024101.875256407.502641630.007323260.014813040.0561104320.447
851024100.691256402.763641611.053323222.107812888.4271103107.419
86102499.533256398.134641592.536323185.071812740.2841101922.276
87102498.402256393.610641574.439323148.877812595.5091100764.068
88102497.297256389.187641556.748323113.496812453.986199631.888
89102496.216256384.863641539.451323078.902812315.608198524.867
90102495.158256380.633641522.534323045.068812180.272197442.176
91102494.124256376.496641505.985323011.969812047.878196383.022
92102493.112256372.448641489.791322979.583811918.331195346.645
93102492.121256368.486641473.942322947.885811791.540194332.319
94102491.152256364.607641458.427322916.855811667.418193339.347
95102490.202256360.809641443.235322886.471811545.883192367.062
96102489.272256357.089641428.357322856.713811426.853191414.825
97102488.361256353.445641413.782322827.563811310.253190482.020
98102487.469256349.875641399.501322799.002811196.008189568.061
99102486.594256346.376641385.506322771.012811084.048188672.380
100102485.737256342.947641371.788322743.576810974.304187794.436
101102484.896256339.585641358.339322716.678810866.713186933.706
102102484.072256336.288641345.151322690.303810761.211186089.689
103102483.264256333.054641332.217322664.434810657.738185261.904
104102482.471256329.882641319.529322639.059810556.236184449.886
105102481.693256326.770641307.081322614.162810456.649183653.189
106102480.929256323.716641294.865322589.731810358.923182871.383
107102480.180256320.719641282.876322565.752810263.007182104.056
108102479.444256317.777641271.106322542.213810168.851181350.807
109102478.722256314.888641259.551322519.102810076.407180611.255
110102478.013256312.051641248.204322496.40789985.628179885.027
111102477.316256309.265641237.059322474.11889896.471179171.768
112102476.632256306.528641226.111322452.22389808.892178471.133
113102475.960256303.839641215.356322430.71289722.849177782.789
114102475.299256301.197641204.788322409.57689638.302177106.417
115102474.650256298.600641194.402322388.80389555.213176441.707
116102474.012256296.048641184.193322368.38689473.545175788.359
117102473.385256293.539641174.158322348.31589393.261175146.085
118102472.768256291.073641164.291322328.58189314.326174514.605
119102472.162256288.647641154.588322309.17789236.706173893.650
120102471.565256286.262641145.046322290.09289160.370173282.959
121102470.979256283.915641135.661322271.32189085.285172682.279
122102470.402256281.607641126.428322252.85589011.421172091.366
123102469.834256279.336641117.343322234.68788938.748171509.984
124102469.275256277.101641108.405322216.80988867.238170937.904
125102468.725256274.902641099.608322199.21688796.863170374.905
126102468.184256272.737641090.950322181.89988727.596169820.772
127102467.652256270.607641082.427322164.85388659.412169275.297
128102467.127256268.509641074.036322148.07188592.285168738.279
129102466.611256266.443641065.774322131.54888526.190168209.523
130102466.102256264.410641057.638322115.27688461.105167688.840
131102465.602256262.406641049.626322099.25188397.006167176.045
132102465.108256260.433641041.734322083.46888333.870166670.962
133102464.622256258.490641033.960322067.91988271.677166173.418
134102464.144256256.575641026.301322052.60188210.406165683.244
135102463.672256254.689641018.754322037.50988150.035165200.279
136102463.207256252.830641011.318322022.63688090.546164724.365
137102462.749256250.997641003.990322007.98088031.918164255.348
138102462.298256249.19264996.767321993.53487974.135163793.079
139102461.853256247.41264989.647321979.29487917.177163337.414
140102461.414256245.65764982.628321965.25787861.027162888.213
141102460.982256243.92764975.708321951.41787805.667162445.338
142102460.555256242.22164968.885321937.77187751.082162008.657
143102460.135256240.53964962.157321924.31487697.255161578.042
144102459.720256238.88064955.521321911.04387644.171161153.366
145102459.311256237.24464948.977321897.95387591.813160734.507
146102458.908256235.63064942.521321885.04287540.168160321.347
147102458.510256234.03864936.153321872.30587489.221159913.770
148102458.117256232.46764929.870321859.74087438.958159511.664
149102457.729256230.91864923.671321847.34187389.365159114.920
150102457.347256229.38864917.554321835.10787340.429158723.430
151102456.970256227.87964911.517321823.03487292.137158337.092
152102456.597256226.39064905.559321811.11987244.475157955.804
153102456.230256224.92064899.679321799.35887197.433157579.468
154102455.867256223.46964893.875321787.75087150.998157207.987
155102455.509256222.03664888.145321776.29087105.159156841.269
156102455.155256220.62264882.488321764.97687059.903156479.223
157102454.806256219.22664876.902321753.80587015.220156121.759
158102454.462256217.84764871.387321742.77586971.099155768.792
159102454.121256216.48564865.941321731.88286927.530155420.238
160102453.785256215.14164860.563321721.12586884.502155076.012
161102453.453256213.81364855.251321710.50186842.005154736.037
162102453.125256212.50164850.004321700.00786800.029154400.233
163102452.801256211.20564844.821321689.64186758.566154068.524
164102452.481256209.92564839.701321679.40186717.605153740.836
165102452.165256208.66164834.642321669.28486677.137153417.096
166102451.853256207.41164829.644321659.28986637.154153097.234
167102451.544256206.17664824.706321649.41286597.647152781.179
168102451.239256204.95664819.826321639.65286558.608152468.864
169102450.938256203.75164815.003321630.00786520.028152160.224
170102450.640256202.55964810.237321620.47586481.899151855.193
171102450.345256201.38264805.527321611.05386444.214151553.709
172102450.054256200.21864800.870321601.74186406.964151255.711
173102449.767256199.06764796.268321592.53686370.142150961.138
174102449.482256197.92964791.718321583.43586333.741150669.931
175102449.201256196.80564787.219321574.43986297.754150382.034
176102448.923256195.69364782.772321565.54386262.174150097.390
177102448.648256194.59464778.374321556.74886226.993149815.944
178102448.377256193.50664774.026321548.05186192.205149537.642
179102448.108256192.43164769.726321539.45186157.804149262.433
180102447.842256191.36864765.473321530.94686123.783148990.265
181102447.579256190.31764761.267321522.53486090.136148721.088
182102447.319256189.27764757.107321514.21486056.857148454.852
183102447.062256188.24864752.992321505.98586023.939148191.511
184102446.808256187.23164748.922321497.84485991.377147931.016
185102446.556256186.22464744.896321489.79185959.165147673.323
186102446.307256185.22864740.912321481.82585927.298147418.385
187102446.061256184.24364736.971321473.94285895.770147166.160
188102445.817256183.26864733.072321466.14485864.575146916.603
189102445.576256182.30364729.214321458.42785833.709146669.674
190102445.337256181.34964725.396321450.79285803.166146425.330
191102445.101256180.40464721.618321443.23585772.941146183.531
192102444.867256179.47064717.879321435.75785743.030145944.238
193102444.636256178.54564714.178321428.35785713.427145707.412
194102444.407256177.62964710.516321421.03285684.127145473.015
195102444.181256176.72364706.891321413.78285655.126145241.010
196102443.956256175.82664703.303321406.60585626.420145011.360
197102443.734256174.93864699.750321399.50185598.004144784.030
198102443.515256174.05964696.234321392.46885569.873144558.985
199102443.297256173.18864692.753321385.50685542.024144336.190
200102443.082256172.32764689.306321378.61385514.451144115.612
201102442.868256171.47464685.894321371.78885487.152143897.218
202102442.657256170.62964682.515321365.03085460.122143680.975
203102442.448256169.79264679.170321358.33985433.357143466.853
204102442.241256168.96464675.857321351.71385406.852143254.820
205102442.036256168.14464672.576321345.15185380.606143044.845
206102441.833256167.33264669.327321338.65385354.612142836.899
207102441.632256166.52764666.109321332.21785328.869142630.952
208102441.433256165.73064662.922321325.84385303.372142426.976
209102441.235256164.94164659.765321319.52985278.118142224.943
210102441.040256164.15964656.638321313.27685253.103142024.825
211102440.846256163.38564653.541321307.08185228.324141826.594
212102440.655256162.61864650.472321300.94585203.778141630.225
213102440.465256161.85864647.433321294.86585179.461141435.692
214102440.276256161.10564644.421321288.84385155.371141242.967
215102440.090256160.35964641.438321282.87685131.503141052.028
216102439.905256159.62064638.482321276.96485107.856140862.848
217102439.722256158.88864635.553321271.10685084.425140675.404
218102439.541256158.16364632.651321265.30285061.209140489.671
219102439.361256157.44464629.775321259.55185038.203140305.627
220102439.183256156.73164626.926321253.85285015.406140123.249
221102439.006256156.02564624.102321248.20484992.814139942.514
222102438.831256155.32664621.303321242.60684970.425139763.399
223102438.658256154.63264618.529321237.05984948.235139585.884
224102438.486256153.94564615.780321231.56184926.243139409.947
225102438.316256153.26464613.056321226.11184904.446139235.566
226102438.147256152.58964610.355321220.71084882.840139062.722
227102437.980256151.92064607.678321215.35684861.424138891.395
228102437.814256151.25664605.024321210.04984840.195138721.563
229102437.650256150.59864602.394321204.78884819.151138553.209
230102437.487256149.94764599.786321199.57284798.289138386.312
231102437.325256149.30064597.201321194.40284777.607138220.853
232102437.165256148.65964594.638321189.27584757.102138056.815
233102437.006256148.02464592.097321184.19384736.772137894.179
234102436.849256147.39464589.577321179.15484716.616137732.928
235102436.692256146.77064587.079321174.15884696.630137573.042
236102436.538256146.15064584.602321169.20384676.813137414.506
237102436.384256145.53664582.145321164.29184657.163137257.303
238102436.232256144.92764579.710321159.41984637.677137101.414
239102436.081256144.32464577.294321154.58884618.353136946.825
240102435.931256143.72564574.899321149.79784599.190136793.519
241102435.783256143.13164572.523321145.04684580.185136641.479
242102435.635256142.54264570.167321140.33484561.336136490.691
243102435.489256141.95864567.830321135.66184542.642136341.139
244102435.345256141.37864565.513321131.02584524.101136192.808
245102435.201256140.80364563.214321126.42884505.710136045.683
246102435.058256140.23364560.934321121.86784487.469135899.749
247102434.917256139.66864558.672321117.34384469.374135754.992
248102434.777256139.10764556.428321112.85684451.425135611.398
249102434.638256138.55164554.202321108.40584433.619135468.952
250102434.500256137.99964551.994321103.98984415.955135327.641
251102434.363256137.45164549.804321099.60884398.432135187.452
252102434.227256136.90864547.631321095.26284381.046135048.372
253102434.092256136.36964545.475321090.95084363.798134910.386
254102433.958256135.83464543.336321086.67184346.685134773.482
255102433.826256135.30364541.213321082.42784329.706134637.648
w3cw3c
automatyka przemysłowa