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: 2000000 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010241953.1252567812.50064312503262500825000012000000
11024976.5622563906.25064156253231250812500011000000
21024651.0422562604.1676410416.6673220833.333883333.3331666666.667
31024488.2812561953.125647812.50032156258625001500000
41024390.6252561562.50064625032125008500001400000
51024325.5212561302.083645208.3333210416.667841666.6671333333.333
61024279.0182561116.071644464.286328928.571835714.2861285714.286
71024244.141256976.562643906.250327812.5008312501250000
81024217.014256868.056643472.222326944.444827777.7781222222.222
91024195.312256781.2506431253262508250001200000
101024177.557256710.227642840.909325681.818822727.2731181818.182
111024162.760256651.042642604.167325208.333820833.3331166666.667
121024150.240256600.962642403.846324807.692819230.7691153846.154
131024139.509256558.036642232.143324464.286817857.1431142857.143
141024130.208256520.833642083.333324166.667816666.6671133333.333
151024122.070256488.281641953.125323906.2508156251125000
161024114.890256459.559641838.235323676.471814705.8821117647.059
171024108.507256434.028641736.111323472.222813888.8891111111.111
181024102.796256411.184641644.737323289.474813157.8951105263.158
19102497.656256390.625641562.5003231258125001100000
20102493.006256372.024641488.095322976.190811904.762195238.095
21102488.778256355.114641420.455322840.909811363.636190909.091
22102484.918256339.674641358.696322717.391810869.565186956.522
23102481.380256325.521641302.083322604.167810416.667183333.333
24102478.125256312.500641250322500810000180000
25102475.120256300.481641201.923322403.84689615.385176923.077
26102472.338256289.352641157.407322314.81589259.259174074.074
27102469.754256279.018641116.071322232.14388928.571171428.571
28102467.349256269.397641077.586322155.17288620.690168965.517
29102465.104256260.417641041.667322083.33388333.333166666.667
30102463.004256252.016641008.065322016.12988064.516164516.129
31102461.035256244.14164976.562321953.12587812.500162500
32102459.186256236.74264946.970321893.93987575.758160606.061
33102457.445256229.77964919.118321838.23587352.941158823.529
34102455.804256223.21464892.857321785.71487142.857157142.857
35102454.253256217.01464868.056321736.11186944.444155555.556
36102452.787256211.14964844.595321689.18986756.757154054.054
37102451.398256205.59264822.368321644.73786578.947152631.579
38102450.080256200.32164801.282321602.56486410.256151282.051
39102448.828256195.31264781.250321562.50086250150000
40102447.637256190.54964762.195321524.39086097.561148780.488
41102446.503256186.01264744.048321488.09585952.381147619.048
42102445.422256181.68664726.744321453.48885813.953146511.628
43102444.389256177.55764710.227321420.45585681.818145454.545
44102443.403256173.61164694.444321388.88985555.556144444.444
45102442.459256169.83764679.348321358.69685434.783143478.261
46102441.556256166.22364664.894321329.78785319.149142553.191
47102440.690256162.76064651.042321302.08385208.333141666.667
48102439.860256159.43964637.755321275.51085102.041140816.327
49102439.062256156.2506462532125085000140000
50102438.297256153.18664612.745321225.49084901.961139215.686
51102437.560256150.24064600.962321201.92384807.692138461.538
52102436.851256147.40664589.623321179.24584716.981137735.849
53102436.169256144.67664578.704321157.40784629.630137037.037
54102435.511256142.04564568.182321136.36484545.455136363.636
55102434.877256139.50964558.036321116.07184464.286135714.286
56102434.265256137.06164548.246321096.49184385.965135087.719
57102433.675256134.69864538.793321077.58684310.345134482.759
58102433.104256132.41564529.661321059.32284237.288133898.305
59102432.552256130.20864520.833321041.66784166.667133333.333
60102432.018256128.07464512.295321024.59084098.361132786.885
61102431.502256126.00864504.032321008.06584032.258132258.065
62102431.002256124.00864496.03232992.06383968.254131746.032
63102430.518256122.07064488.28132976.56283906.250131250
64102430.048256120.19264480.76932961.53883846.154130769.231
65102429.593256118.37164473.48532946.97083787.879130303.030
66102429.151256116.60464466.41832932.83683731.343129850.746
67102428.722256114.89064459.55932919.11883676.471129411.765
68102428.306256113.22564452.89932905.79783623.188128985.507
69102427.902256111.60764446.42932892.85783571.429128571.429
70102427.509256110.03564440.14132880.28283521.127128169.014
71102427.127256108.50764434.02832868.05683472.222127777.778
72102426.755256107.02164428.08232856.16483424.658127397.260
73102426.394256105.57464422.29732844.59583378.378127027.027
74102426.042256104.16764416.66732833.33383333.333126666.667
75102425.699256102.79664411.18432822.36883289.474126315.789
76102425.365256101.46164405.84432811.68883246.753125974.026
77102425.040256100.16064400.64132801.28283205.128125641.026
78102424.72325698.89264395.57032791.13983164.557125316.456
79102424.41425697.65664390.62532781.25083125125000
80102424.11325696.45164385.80232771.60583086.420124691.358
81102423.81925695.27464381.09832762.19583048.780124390.244
82102423.53225694.12764376.50632753.01283012.048124096.386
83102423.25125693.00664372.02432744.04882976.190123809.524
84102422.97825691.91264367.64732735.29482941.176123529.412
85102422.71125690.84364363.37232726.74482906.977123255.814
86102422.45025689.79964359.19532718.39182873.563122988.506
87102422.19525688.77864355.11432710.22782840.909122727.273
88102421.94525687.78164351.12432702.24782808.989122471.910
89102421.70125686.80664347.22232694.44482777.778122222.222
90102421.46325685.85264343.40732686.81382747.253121978.022
91102421.23025684.91864339.67432679.34882717.391121739.130
92102421.00125684.00564336.02232672.04382688.172121505.376
93102420.77825683.11264332.44732664.89482659.574121276.596
94102420.55925682.23764328.94732657.89582631.579121052.632
95102420.34525681.38064325.52132651.04282604.167120833.333
96102420.13525680.54164322.16532644.33082577.320120618.557
97102419.93025679.71964318.87832637.75582551.020120408.163
98102419.72925678.91464315.65732631.31382525.253120202.020
99102419.53125678.12564312.5003262582500120000
100102419.33825677.35164309.40632618.81282475.248119801.980
101102419.14825676.59364306.37332612.74582450.980119607.843
102102418.96225675.85064303.39832606.79682427.184119417.476
103102418.78025675.12064300.48132600.96282403.846119230.769
104102418.60125674.40564297.61932595.23882380.952119047.619
105102418.42625673.70364294.81132589.62382358.491118867.925
106102418.25425673.01464292.05632584.11282336.449118691.589
107102418.08425672.33864289.35232578.70482314.815118518.519
108102417.91925671.67464286.69732573.39482293.578118348.624
109102417.75625671.02364284.09132568.18282272.727118181.818
110102417.59625670.38364281.53232563.06382252.252118018.018
111102417.43925669.75464279.01832558.03682232.143117857.143
112102417.28425669.13764276.54932553.09782212.389117699.115
113102417.13325668.53164274.12332548.24682192.982117543.860
114102416.98425667.93564271.73932543.47882173.913117391.304
115102416.83725667.34964269.39732538.79382155.172117241.379
116102416.69325666.77464267.09432534.18882136.752117094.017
117102416.55225666.20864264.83132529.66182118.644116949.153
118102416.41325665.65164262.60532525.21082100.840116806.723
119102416.27625665.10464260.41732520.83382083.333116666.667
120102416.14225664.56664258.26432516.52982066.116116528.926
121102416.00925664.03764256.14832512.29582049.180116393.443
122102415.87925663.51664254.06532508.13082032.520116260.163
123102415.75125663.00464252.01632504.03282016.129116129.032
124102415.62525662.500642503250082000116000
125102415.50125662.00464248.01632496.03281984.127115873.016
126102415.37925661.51664246.06332492.12681968.504115748.031
127102415.25925661.03564244.14132488.28181953.125115625
128102415.14125660.56264242.24832484.49681937.984115503.876
129102415.02425660.09664240.38532480.76981923.077115384.615
130102414.90925659.63764238.55032477.09981908.397115267.176
131102414.79625659.18664236.74232473.48581893.939115151.515
132102414.68525658.74164234.96232469.92581879.699115037.594
133102414.57625658.30264233.20932466.41881865.672114925.373
134102414.46825657.87064231.48132462.96381851.852114814.815
135102414.36125657.44564229.77932459.55981838.235114705.882
136102414.25625657.02664228.10232456.20481824.818114598.540
137102414.15325656.61264226.44932452.89981811.594114492.754
138102414.05125656.20564224.82032449.64081798.561114388.489
139102413.95125655.80464223.21432446.42981785.714114285.714
140102413.85225655.40864221.63132443.26281773.050114184.397
141102413.75425655.01864220.07032440.14181760.563114084.507
142102413.65825654.63364218.53132437.06381748.252113986.014
143102413.56325654.25364217.01432434.02881736.111113888.889
144102413.47025653.87964215.51732431.03481724.138113793.103
145102413.37825653.51064214.04132428.08281712.329113698.630
146102413.28725653.14664212.58532425.17081700.680113605.442
147102413.19725652.78764211.14932422.29781689.189113513.514
148102413.10825652.43364209.73232419.46381677.852113422.819
149102413.02125652.08364208.33332416.66781666.667113333.333
150102412.93525651.73864206.95432413.90781655.629113245.033
151102412.85025651.39864205.59232411.18481644.737113157.895
152102412.76625651.06264204.24832408.49781633.987113071.895
153102412.68325650.73164202.92232405.84481623.377112987.013
154102412.60125650.40364201.61332403.22681612.903112903.226
155102412.52025650.08064200.32132400.64181602.564112820.513
156102412.44025649.76164199.04532398.08981592.357112738.854
157102412.36225649.44664197.78532395.57081582.278112658.228
158102412.28425649.13564196.54132393.08281572.327112578.616
159102412.20725648.82864195.31232390.62581562.500112500
160102412.13125648.52564194.09932388.19981552.795112422.360
161102412.05625648.22564192.90132385.80281543.210112345.679
162102411.98225647.92964191.71832383.43681533.742112269.939
163102411.90925647.63764190.54932381.09881524.390112195.122
164102411.83725647.34864189.39432378.78881515.152112121.212
165102411.76625647.06364188.25332376.50681506.024112048.193
166102411.69525646.78164187.12632374.25181497.006111976.048
167102411.62625646.50364186.01232372.02481488.095111904.762
168102411.55725646.22864184.91132369.82281479.290111834.320
169102411.48925645.95664183.82432367.64781470.588111764.706
170102411.42225645.68764182.74932365.49781461.988111695.906
171102411.35525645.42264181.68632363.37281453.488111627.907
172102411.29025645.15964180.63632361.27281445.087111560.694
173102411.22525644.89964179.59832359.19581436.782111494.253
174102411.16125644.64364178.57132357.14381428.571111428.571
175102411.09725644.38964177.55732355.11481420.455111363.636
176102411.03525644.13864176.55432353.10781412.429111299.435
177102410.97325643.89064175.56232351.12481404.494111235.955
178102410.91125643.64564174.58132349.16281396.648111173.184
179102410.85125643.40364173.61132347.22281388.889111111.111
180102410.79125643.16364172.65232345.30481381.215111049.724
181102410.73125642.92664171.70332343.40781373.626110989.011
182102410.67325642.69164170.76532341.53081366.120110928.962
183102410.61525642.45964169.83732339.67481358.696110869.565
184102410.55725642.23064168.91932337.83881351.351110810.811
185102410.50125642.00364168.01132336.02281344.086110752.688
186102410.44525641.77864167.11232334.22581336.898110695.187
187102410.38925641.55664166.22332332.44781329.787110638.298
188102410.33425641.33664165.34432330.68881322.751110582.011
189102410.28025641.11864164.47432328.94781315.789110526.316
190102410.22625640.90364163.61332327.22581308.901110471.204
191102410.17325640.69064162.76032325.52181302.083110416.667
192102410.12025640.47964161.91732323.83481295.337110362.694
193102410.06825640.27164161.08232322.16581288.660110309.278
194102410.01625640.06464160.25632320.51381282.051110256.410
19510249.96525639.86064159.43932318.87881275.510110204.082
19610249.91425639.65764158.62932317.25981269.036110152.284
19710249.86425639.45764157.82832315.65781262.626110101.010
19810249.81525639.25964157.03532314.07081256.281110050.251
19910249.76625639.06264156.25032312.50081250110000
20010249.71725638.86864155.47332310.94581243.78119950.249
20110249.66925638.67664154.70332309.40681237.62419900.990
20210249.62125638.48564153.94132307.88281231.52719852.217
20310249.57425638.29764153.18632306.37381225.49019803.922
20410249.52725638.11064152.43932304.87881219.51219756.098
20510249.48125637.92564151.69932303.39881213.59219708.738
20610249.43525637.74264150.96632301.93281207.72919661.836
20710249.39025637.56064150.24032300.48181201.92319615.385
20810249.34525637.38064149.52232299.04381196.17219569.378
20910249.30125637.20264148.81032297.61981190.47619523.810
21010249.25725637.02664148.10432296.20981184.83419478.673
21110249.21325636.85164147.40632294.81181179.24519433.962
21210249.17025636.67864146.71432293.42781173.70919389.671
21310249.12725636.50764146.02832292.05681168.22419345.794
21410249.08425636.33764145.34932290.69881162.79119302.326
21510249.04225636.16964144.67632289.35281157.40719259.259
21610249.00125636.00264144.00932288.01881152.07419216.590
21710248.95925635.83764143.34932286.69781146.78919174.312
21810248.91825635.67464142.69432285.38881141.55319132.420
21910248.87825635.51164142.04532284.09181136.36419090.909
22010248.83825635.35164141.40332282.80581131.22219049.774
22110248.79825635.19164140.76632281.53281126.12619009.009
22210248.75825635.03464140.13532280.26981121.07618968.610
22310248.71925634.87764139.50932279.01881116.07118928.571
22410248.68125634.72264138.88932277.77881111.11118888.889
22510248.64225634.56964138.27432276.54981106.19518849.558
22610248.60425634.41664137.66532275.33081101.32218810.573
22710248.56625634.26564137.06132274.12381096.49118771.930
22810248.52925634.11664136.46332272.92681091.70318733.624
22910248.49225633.96764135.87032271.73981086.95718695.652
23010248.45525633.82064135.28132270.56381082.25118658.009
23110248.41925633.67564134.69832269.39781077.58618620.690
23210248.38325633.53064134.12032268.24081072.96118583.691
23310248.34725633.38764133.54732267.09481068.37618547.009
23410248.31125633.24564132.97932265.95781063.83018510.638
23510248.27625633.10464132.41532264.83181059.32218474.576
23610248.24125632.96464131.85732263.71381054.85218438.819
23710248.20625632.82664131.30332262.60581050.42018403.361
23810248.17225632.68864130.75332261.50681046.02518368.201
23910248.13825632.55264130.20832260.41781041.66718333.333
24010248.10425632.41764129.66832259.33681037.34418298.755
24110248.07125632.28364129.13232258.26481033.05818264.463
24210248.03825632.15064128.60132257.20281028.80718230.453
24310248.00525632.01864128.07432256.14881024.59018196.721
24410247.97225631.88864127.55132255.10281020.40818163.265
24510247.94025631.75864127.03332254.06581016.26018130.081
24610247.90725631.63064126.51832253.03681012.14618097.166
24710247.87625631.50264126.00832252.01681008.06518064.516
24810247.84425631.37664125.50232251.00481004.01618032.129
24910247.81225631.25064125322508100018000
25010247.78125631.12564124.50232249.0048996.01617968.127
25110247.75025631.00264124.00832248.0168992.06317936.508
25210247.72025630.87964123.51832247.0368988.14217905.138
25310247.68925630.75864123.03132246.0638984.25217874.016
25410247.65925630.63764122.54932245.0988980.39217843.137
25510247.62925630.51864122.07032244.1418976.56217812.500
w3cw3c
automatyka przemysłowa