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: 8000000 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010247812.5002563125064125000322500008100000018000000
110243906.25025615625646250032125000850000014000000
210242604.16725610416.6676441666.6673283333.3338333333.33312666666.667
310241953.1252567812.50064312503262500825000012000000
410241562.500256625064250003250000820000011600000
510241302.0832565208.3336420833.3333241666.6678166666.66711333333.333
610241116.0712564464.2866417857.1433235714.2868142857.14311142857.143
71024976.5622563906.25064156253231250812500011000000
81024868.0562563472.2226413888.8893227777.7788111111.1111888888.889
91024781.25025631256412500322500081000001800000
101024710.2272562840.9096411363.6363222727.273890909.0911727272.727
111024651.0422562604.1676410416.6673220833.333883333.3331666666.667
121024600.9622562403.846649615.3853219230.769876923.0771615384.615
131024558.0362562232.143648928.5713217857.143871428.5711571428.571
141024520.8332562083.333648333.3333216666.667866666.6671533333.333
151024488.2812561953.125647812.50032156258625001500000
161024459.5592561838.235647352.9413214705.882858823.5291470588.235
171024434.0282561736.111646944.4443213888.889855555.5561444444.444
181024411.1842561644.737646578.9473213157.895852631.5791421052.632
191024390.6252561562.50064625032125008500001400000
201024372.0242561488.095645952.3813211904.762847619.0481380952.381
211024355.1142561420.455645681.8183211363.636845454.5451363636.364
221024339.6742561358.696645434.7833210869.565843478.2611347826.087
231024325.5212561302.083645208.3333210416.667841666.6671333333.333
241024312.500256125064500032100008400001320000
251024300.4812561201.923644807.692329615.385838461.5381307692.308
261024289.3522561157.407644629.630329259.259837037.0371296296.296
271024279.0182561116.071644464.286328928.571835714.2861285714.286
281024269.3972561077.586644310.345328620.690834482.7591275862.069
291024260.4172561041.667644166.667328333.333833333.3331266666.667
301024252.0162561008.065644032.258328064.516832258.0651258064.516
311024244.141256976.562643906.250327812.5008312501250000
321024236.742256946.970643787.879327575.758830303.0301242424.242
331024229.779256919.118643676.471327352.941829411.7651235294.118
341024223.214256892.857643571.429327142.857828571.4291228571.429
351024217.014256868.056643472.222326944.444827777.7781222222.222
361024211.149256844.595643378.378326756.757827027.0271216216.216
371024205.592256822.368643289.474326578.947826315.7891210526.316
381024200.321256801.282643205.128326410.256825641.0261205128.205
391024195.312256781.2506431253262508250001200000
401024190.549256762.195643048.780326097.561824390.2441195121.951
411024186.012256744.048642976.190325952.381823809.5241190476.190
421024181.686256726.744642906.977325813.953823255.8141186046.512
431024177.557256710.227642840.909325681.818822727.2731181818.182
441024173.611256694.444642777.778325555.556822222.2221177777.778
451024169.837256679.348642717.391325434.783821739.1301173913.043
461024166.223256664.894642659.574325319.149821276.5961170212.766
471024162.760256651.042642604.167325208.333820833.3331166666.667
481024159.439256637.755642551.020325102.041820408.1631163265.306
491024156.2502566256425003250008200001160000
501024153.186256612.745642450.980324901.961819607.8431156862.745
511024150.240256600.962642403.846324807.692819230.7691153846.154
521024147.406256589.623642358.491324716.981818867.9251150943.396
531024144.676256578.704642314.815324629.630818518.5191148148.148
541024142.045256568.182642272.727324545.455818181.8181145454.545
551024139.509256558.036642232.143324464.286817857.1431142857.143
561024137.061256548.246642192.982324385.965817543.8601140350.877
571024134.698256538.793642155.172324310.345817241.3791137931.034
581024132.415256529.661642118.644324237.288816949.1531135593.220
591024130.208256520.833642083.333324166.667816666.6671133333.333
601024128.074256512.295642049.180324098.361816393.4431131147.541
611024126.008256504.032642016.129324032.258816129.0321129032.258
621024124.008256496.032641984.127323968.254815873.0161126984.127
631024122.070256488.281641953.125323906.2508156251125000
641024120.192256480.769641923.077323846.154815384.6151123076.923
651024118.371256473.485641893.939323787.879815151.5151121212.121
661024116.604256466.418641865.672323731.343814925.3731119402.985
671024114.890256459.559641838.235323676.471814705.8821117647.059
681024113.225256452.899641811.594323623.188814492.7541115942.029
691024111.607256446.429641785.714323571.429814285.7141114285.714
701024110.035256440.141641760.563323521.127814084.5071112676.056
711024108.507256434.028641736.111323472.222813888.8891111111.111
721024107.021256428.082641712.329323424.658813698.6301109589.041
731024105.574256422.297641689.189323378.378813513.5141108108.108
741024104.167256416.667641666.667323333.333813333.3331106666.667
751024102.796256411.184641644.737323289.474813157.8951105263.158
761024101.461256405.844641623.377323246.753812987.0131103896.104
771024100.160256400.641641602.564323205.128812820.5131102564.103
78102498.892256395.570641582.278323164.557812658.2281101265.823
79102497.656256390.625641562.5003231258125001100000
80102496.451256385.802641543.210323086.420812345.679198765.432
81102495.274256381.098641524.390323048.780812195.122197560.976
82102494.127256376.506641506.024323012.048812048.193196385.542
83102493.006256372.024641488.095322976.190811904.762195238.095
84102491.912256367.647641470.588322941.176811764.706194117.647
85102490.843256363.372641453.488322906.977811627.907193023.256
86102489.799256359.195641436.782322873.563811494.253191954.023
87102488.778256355.114641420.455322840.909811363.636190909.091
88102487.781256351.124641404.494322808.989811235.955189887.640
89102486.806256347.222641388.889322777.778811111.111188888.889
90102485.852256343.407641373.626322747.253810989.011187912.088
91102484.918256339.674641358.696322717.391810869.565186956.522
92102484.005256336.022641344.086322688.172810752.688186021.505
93102483.112256332.447641329.787322659.574810638.298185106.383
94102482.237256328.947641315.789322631.579810526.316184210.526
95102481.380256325.521641302.083322604.167810416.667183333.333
96102480.541256322.165641288.660322577.320810309.278182474.227
97102479.719256318.878641275.510322551.020810204.082181632.653
98102478.914256315.657641262.626322525.253810101.010180808.081
99102478.125256312.500641250322500810000180000
100102477.351256309.406641237.624322475.24889900.990179207.921
101102476.593256306.373641225.490322450.98089803.922178431.373
102102475.850256303.398641213.592322427.18489708.738177669.903
103102475.120256300.481641201.923322403.84689615.385176923.077
104102474.405256297.619641190.476322380.95289523.810176190.476
105102473.703256294.811641179.245322358.49189433.962175471.698
106102473.014256292.056641168.224322336.44989345.794174766.355
107102472.338256289.352641157.407322314.81589259.259174074.074
108102471.674256286.697641146.789322293.57889174.312173394.495
109102471.023256284.091641136.364322272.72789090.909172727.273
110102470.383256281.532641126.126322252.25289009.009172072.072
111102469.754256279.018641116.071322232.14388928.571171428.571
112102469.137256276.549641106.195322212.38988849.558170796.460
113102468.531256274.123641096.491322192.98288771.930170175.439
114102467.935256271.739641086.957322173.91388695.652169565.217
115102467.349256269.397641077.586322155.17288620.690168965.517
116102466.774256267.094641068.376322136.75288547.009168376.068
117102466.208256264.831641059.322322118.64488474.576167796.610
118102465.651256262.605641050.420322100.84088403.361167226.891
119102465.104256260.417641041.667322083.33388333.333166666.667
120102464.566256258.264641033.058322066.11688264.463166115.702
121102464.037256256.148641024.590322049.18088196.721165573.770
122102463.516256254.065641016.260322032.52088130.081165040.650
123102463.004256252.016641008.065322016.12988064.516164516.129
124102462.50025625064100032200088000164000
125102462.004256248.01664992.063321984.12787936.508163492.063
126102461.516256246.06364984.252321968.50487874.016162992.126
127102461.035256244.14164976.562321953.12587812.500162500
128102460.562256242.24864968.992321937.98487751.938162015.504
129102460.096256240.38564961.538321923.07787692.308161538.462
130102459.637256238.55064954.198321908.39787633.588161068.702
131102459.186256236.74264946.970321893.93987575.758160606.061
132102458.741256234.96264939.850321879.69987518.797160150.376
133102458.302256233.20964932.836321865.67287462.687159701.493
134102457.870256231.48164925.926321851.85287407.407159259.259
135102457.445256229.77964919.118321838.23587352.941158823.529
136102457.026256228.10264912.409321824.81887299.270158394.161
137102456.612256226.44964905.797321811.59487246.377157971.014
138102456.205256224.82064899.281321798.56187194.245157553.957
139102455.804256223.21464892.857321785.71487142.857157142.857
140102455.408256221.63164886.525321773.05087092.199156737.589
141102455.018256220.07064880.282321760.56387042.254156338.028
142102454.633256218.53164874.126321748.25286993.007155944.056
143102454.253256217.01464868.056321736.11186944.444155555.556
144102453.879256215.51764862.069321724.13886896.552155172.414
145102453.510256214.04164856.164321712.32986849.315154794.521
146102453.146256212.58564850.340321700.68086802.721154421.769
147102452.787256211.14964844.595321689.18986756.757154054.054
148102452.433256209.73264838.926321677.85286711.409153691.275
149102452.083256208.33364833.333321666.66786666.667153333.333
150102451.738256206.95464827.815321655.62986622.517152980.132
151102451.398256205.59264822.368321644.73786578.947152631.579
152102451.062256204.24864816.993321633.98786535.948152287.582
153102450.731256202.92264811.688321623.37786493.506151948.052
154102450.403256201.61364806.452321612.90386451.613151612.903
155102450.080256200.32164801.282321602.56486410.256151282.051
156102449.761256199.04564796.178321592.35786369.427150955.414
157102449.446256197.78564791.139321582.27886329.114150632.911
158102449.135256196.54164786.164321572.32786289.308150314.465
159102448.828256195.31264781.250321562.50086250150000
160102448.525256194.09964776.398321552.79586211.180149689.441
161102448.225256192.90164771.605321543.21086172.840149382.716
162102447.929256191.71864766.871321533.74286134.969149079.755
163102447.637256190.54964762.195321524.39086097.561148780.488
164102447.348256189.39464757.576321515.15286060.606148484.848
165102447.063256188.25364753.012321506.02486024.096148192.771
166102446.781256187.12664748.503321497.00685988.024147904.192
167102446.503256186.01264744.048321488.09585952.381147619.048
168102446.228256184.91164739.645321479.29085917.160147337.278
169102445.956256183.82464735.294321470.58885882.353147058.824
170102445.687256182.74964730.994321461.98885847.953146783.626
171102445.422256181.68664726.744321453.48885813.953146511.628
172102445.159256180.63664722.543321445.08785780.347146242.775
173102444.899256179.59864718.391321436.78285747.126145977.011
174102444.643256178.57164714.286321428.57185714.286145714.286
175102444.389256177.55764710.227321420.45585681.818145454.545
176102444.138256176.55464706.215321412.42985649.718145197.740
177102443.890256175.56264702.247321404.49485617.978144943.820
178102443.645256174.58164698.324321396.64885586.592144692.737
179102443.403256173.61164694.444321388.88985555.556144444.444
180102443.163256172.65264690.608321381.21585524.862144198.895
181102442.926256171.70364686.813321373.62685494.505143956.044
182102442.691256170.76564683.060321366.12085464.481143715.847
183102442.459256169.83764679.348321358.69685434.783143478.261
184102442.230256168.91964675.676321351.35185405.405143243.243
185102442.003256168.01164672.043321344.08685376.344143010.753
186102441.778256167.11264668.449321336.89885347.594142780.749
187102441.556256166.22364664.894321329.78785319.149142553.191
188102441.336256165.34464661.376321322.75185291.005142328.042
189102441.118256164.47464657.895321315.78985263.158142105.263
190102440.903256163.61364654.450321308.90185235.602141884.817
191102440.690256162.76064651.042321302.08385208.333141666.667
192102440.479256161.91764647.668321295.33785181.347141450.777
193102440.271256161.08264644.330321288.66085154.639141237.113
194102440.064256160.25664641.026321282.05185128.205141025.641
195102439.860256159.43964637.755321275.51085102.041140816.327
196102439.657256158.62964634.518321269.03685076.142140609.137
197102439.457256157.82864631.313321262.62685050.505140404.040
198102439.259256157.03564628.141321256.28185025.126140201.005
199102439.062256156.2506462532125085000140000
200102438.868256155.47364621.891321243.78184975.124139800.995
201102438.676256154.70364618.812321237.62484950.495139603.960
202102438.485256153.94164615.764321231.52784926.108139408.867
203102438.297256153.18664612.745321225.49084901.961139215.686
204102438.110256152.43964609.756321219.51284878.049139024.390
205102437.925256151.69964606.796321213.59284854.369138834.951
206102437.742256150.96664603.865321207.72984830.918138647.343
207102437.560256150.24064600.962321201.92384807.692138461.538
208102437.380256149.52264598.086321196.17284784.689138277.512
209102437.202256148.81064595.238321190.47684761.905138095.238
210102437.026256148.10464592.417321184.83484739.336137914.692
211102436.851256147.40664589.623321179.24584716.981137735.849
212102436.678256146.71464586.854321173.70984694.836137558.685
213102436.507256146.02864584.112321168.22484672.897137383.178
214102436.337256145.34964581.395321162.79184651.163137209.302
215102436.169256144.67664578.704321157.40784629.630137037.037
216102436.002256144.00964576.037321152.07484608.295136866.359
217102435.837256143.34964573.394321146.78984587.156136697.248
218102435.674256142.69464570.776321141.55384566.210136529.680
219102435.511256142.04564568.182321136.36484545.455136363.636
220102435.351256141.40364565.611321131.22284524.887136199.095
221102435.191256140.76664563.063321126.12684504.505136036.036
222102435.034256140.13564560.538321121.07684484.305135874.439
223102434.877256139.50964558.036321116.07184464.286135714.286
224102434.722256138.88964555.556321111.11184444.444135555.556
225102434.569256138.27464553.097321106.19584424.779135398.230
226102434.416256137.66564550.661321101.32284405.286135242.291
227102434.265256137.06164548.246321096.49184385.965135087.719
228102434.116256136.46364545.852321091.70384366.812134934.498
229102433.967256135.87064543.478321086.95784347.826134782.609
230102433.820256135.28164541.126321082.25184329.004134632.035
231102433.675256134.69864538.793321077.58684310.345134482.759
232102433.530256134.12064536.481321072.96184291.845134334.764
233102433.387256133.54764534.188321068.37684273.504134188.034
234102433.245256132.97964531.915321063.83084255.319134042.553
235102433.104256132.41564529.661321059.32284237.288133898.305
236102432.964256131.85764527.426321054.85284219.409133755.274
237102432.826256131.30364525.210321050.42084201.681133613.445
238102432.688256130.75364523.013321046.02584184.100133472.803
239102432.552256130.20864520.833321041.66784166.667133333.333
240102432.417256129.66864518.672321037.34484149.378133195.021
241102432.283256129.13264516.529321033.05884132.231133057.851
242102432.150256128.60164514.403321028.80784115.226132921.811
243102432.018256128.07464512.295321024.59084098.361132786.885
244102431.888256127.55164510.204321020.40884081.633132653.061
245102431.758256127.03364508.130321016.26084065.041132520.325
246102431.630256126.51864506.073321012.14684048.583132388.664
247102431.502256126.00864504.032321008.06584032.258132258.065
248102431.376256125.50264502.008321004.01684016.064132128.514
249102431.2502561256450032100084000132000
250102431.125256124.50264498.00832996.01683984.064131872.510
251102431.002256124.00864496.03232992.06383968.254131746.032
252102430.879256123.51864494.07132988.14283952.569131620.553
253102430.758256123.03164492.12632984.25283937.008131496.063
254102430.637256122.54964490.19632980.39283921.569131372.549
255102430.518256122.07064488.28132976.56283906.250131250
w3cw3c
automatyka przemysłowa