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: 1834320 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010241791.3282567165.3126428661.2503257322.500822929011834320
11024895.6642563582.6566414330.6253228661.25081146451917160
21024597.1092562388.438649553.7503219107.5008764301611440
31024447.8322561791.328647165.3123214330.625857322.5001458580
41024358.2662561433.062645732.2503211464.5008458581366864
51024298.5552561194.219644776.875329553.7508382151305720
61024255.9042561023.616644094.464328188.929832755.7141262045.714
71024223.916256895.664643582.656327165.312828661.2501229290
81024199.036256796.146643184.583326369.167825476.6671203813.333
91024179.133256716.531642866.125325732.2508229291183432
101024162.848256651.392642605.568325211.136820844.5451166756.364
111024149.277256597.109642388.438324776.875819107.5001152860
121024137.794256551.178642204.712324409.423817637.6921141101.538
131024127.952256511.808642047.232324094.464816377.8571131022.857
141024119.422256477.688641910.750323821.5008152861122288
151024111.958256447.832641791.328323582.656814330.6251114645
161024105.372256421.489641685.956323371.912813487.6471107901.176
17102499.518256398.073641592.292323184.583812738.3331101906.667
18102494.280256377.122641508.487323016.974812067.895196543.158
19102489.566256358.266641433.062322866.125811464.500191716
20102485.301256341.205641364.821322729.643810918.571187348.571
21102481.424256325.696641302.784322605.568810422.273183378.182
22102477.884256311.535641246.141322492.28389969.130179753.043
23102474.639256298.555641194.219322388.43889553.750176430
24102471.653256286.613641146.450322292.90089171.600173372.800
25102468.897256275.589641102.356322204.71288818.846170550.769
26102466.345256265.382641061.528322123.05688492.222167937.778
27102463.976256255.904641023.616322047.23288188.929165511.429
28102461.770256247.08064988.319321976.63887906.552163252.414
29102459.711256238.84464955.375321910.75087643161144
30102457.785256231.13964924.556321849.11387396.452159171.613
31102455.979256223.91664895.664321791.32887165.312157322.500
32102454.283256217.13164868.523321737.04586948.182155585.455
33102452.686256210.74464842.978321685.95686743.824153950.588
34102451.181256204.72364818.893321637.78686551.143152409.143
35102449.759256199.03664796.146321592.29286369.167150953.333
36102448.414256193.65764774.628321549.25786197.027149576.216
37102447.140256188.56164754.243321508.48786033.947148271.579
38102445.931256183.72664734.904321469.80885879.231147033.846
39102444.783256179.13364716.531321433.06285732.250145858
40102443.691256174.76464699.055321398.11085592.439144739.512
41102442.651256170.60364682.411321364.82185459.286143674.286
42102441.659256166.63564666.541321333.08185332.326142658.605
43102440.712256162.84864651.392321302.78485211.136141689.091
44102439.807256159.22964636.917321273.83385095.333140762.667
45102438.942256155.76864623.071321246.14184984.565139876.522
46102438.113256152.45364609.814321219.62884878.511139028.085
47102437.319256149.27764597.109321194.21984776.875138215
48102436.558256146.23164584.923321169.84784679.388137435.102
49102435.827256143.30664573.225321146.45084585.800136686.400
50102435.124256140.49664561.985321123.97184495.882135967.059
51102434.449256137.79464551.178321102.35684409.423135275.385
52102433.799256135.19564540.778321081.55784326.226134609.811
53102433.173256132.69164530.764321061.52884246.111133968.889
54102432.570256130.27864521.114321042.22784168.909133351.273
55102431.988256127.95264511.808321023.61684094.464132755.714
56102431.427256125.70764502.829321005.65884022.632132181.053
57102430.885256123.54064494.15932988.31983953.276131626.207
58102430.361256121.44664485.78432971.56883886.271131090.169
59102429.855256119.42264477.68832955.37583821.500130572
60102429.366256117.46464469.85732939.71383758.852130070.820
61102428.892256115.57064462.27832924.55683698.226129585.806
62102428.434256113.73564454.94032909.88183639.524129116.190
63102427.990256111.95864447.83232895.66483582.656128661.250
64102427.559256110.23664440.94232881.88583527.538128220.308
65102427.141256108.56564434.26132868.52383474.091127792.727
66102426.736256106.94564427.78032855.56083422.239127377.910
67102426.343256105.37264421.48932842.97883371.912126975.294
68102425.961256103.84564415.38032830.76183323.043126584.348
69102425.590256102.36264409.44632818.89383275.571126204.571
70102425.230256100.92064403.68032807.35983229.437125835.493
71102424.88025699.51864398.07332796.14683184.583125476.667
72102424.53925698.15564392.62032785.24083140.959125127.671
73102424.20725696.82964387.31432774.62883098.514124788.108
74102423.88425695.53764382.15032764.30083057.200124457.600
75102423.57025694.28064377.12232754.24383016.974124135.789
76102423.26425693.05664372.22432744.44882977.792123822.338
77102422.96625691.86364367.45232734.90482939.615123516.923
78102422.67525690.70064362.80132725.60182902.405123219.241
79102422.39225689.56664358.26632716.53182866.125122929
80102422.11525688.46164353.84332707.68582830.741122645.926
81102421.84525687.38264349.52732699.05582796.220122369.756
82102421.58225686.32964345.31632690.63382762.530122100.241
83102421.32525685.30164341.20532682.41182729.643121837.143
84102421.07425684.29864337.19132674.38282697.529121580.235
85102420.82925683.31864333.27032666.54182666.163121329.302
86102420.59025682.36064329.44032658.87982635.517121084.138
87102420.35625681.42464325.69632651.39282605.568120844.545
88102420.12725680.50964322.03732644.07382576.292120610.337
89102419.90425679.61564318.45832636.91782547.667120381.333
90102419.68525678.74064314.95932629.91882519.670120157.363
91102419.47125677.88464311.53532623.07182492.283119938.261
92102419.26225677.04664308.18532616.37182465.484119723.871
93102419.05725676.22764304.90732609.81482439.255119514.043
94102418.85625675.42464301.69732603.39582413.579119308.632
95102418.66025674.63964298.55532597.10982388.438119107.500
96102418.46725673.86964295.47732590.95482363.814118910.515
97102418.27925673.11564292.46232584.92382339.694118717.551
98102418.09425672.37764289.50832579.01582316.061118528.485
99102417.91325671.65364286.61332573.22582292.900118343.200
100102417.73625670.94464283.77532567.55082270.198118161.584
101102417.56225670.24864280.99332561.98582247.941117983.529
102102417.39225669.56664278.26532556.52982226.117117808.932
103102417.22425668.89764275.58932551.17882204.712117637.692
104102417.06025668.24164272.96432545.92982183.714117469.714
105102416.89925667.59764270.38932540.77882163.113117304.906
106102416.74125666.96664267.86232535.72482142.897117143.178
107102416.58625666.34564265.38232530.76482123.056116984.444
108102416.43425665.73764262.94732525.89482103.578116828.624
109102416.28525665.13964260.55732521.11482084.455116675.636
110102416.13825664.55264258.20932516.41982065.676116525.405
111102415.99425663.97664255.90432511.80882047.232116377.857
112102415.85225663.41064253.63932507.27982029.115116232.920
113102415.71325662.85464251.41432502.82982011.316116090.526
114102415.57725662.30764249.22832498.45781993.826115950.609
115102415.44225661.77064247.08032494.15981976.638115813.103
116102415.31025661.24264244.96832489.93681959.744115677.949
117102415.18125660.72364242.89232485.78481943.136115545.085
118102415.05325660.21364240.85132481.70281926.807115414.454
119102414.92825659.71164238.84432477.68881910.750115286
120102414.80425659.21764236.87032473.74081894.959115159.669
121102414.68325658.73264234.92832469.85781879.426115035.410
122102414.56425658.25564233.01832466.03781864.146114913.171
123102414.44625657.78564231.13932462.27881849.113114792.903
124102414.33125657.32264229.29032458.58081834.320114674.560
125102414.21725656.86864227.47032454.94081819.762114558.095
126102414.10525656.42064225.67932451.35881805.433114443.465
127102413.99525655.97964223.91632447.83281791.328114330.625
128102413.88625655.54564222.18032444.36081777.442114219.535
129102413.77925655.11864220.47132440.94281763.769114110.154
130102413.67425654.69764218.78832437.57681750.305114002.443
131102413.57125654.28364217.13132434.26181737.045113896.364
132102413.46925653.87564215.49832430.99681723.985113791.880
133102413.36825653.47264213.89032427.78081711.119113688.955
134102413.26925653.07664212.30632424.61181698.444113587.556
135102413.17225652.68664210.74432421.48981685.956113487.647
136102413.07525652.30264209.20632418.41281673.650113389.197
137102412.98125651.92364207.69032415.38081661.522113292.174
138102412.88725651.54964206.19632412.39281649.568113196.547
139102412.79525651.18164204.72332409.44681637.786113102.286
140102412.70425650.81864203.27132406.54381626.170113009.362
141102412.61525650.46064201.84032403.68081614.718112917.746
142102412.52725650.10764200.42832400.85781603.427112827.413
143102412.44025649.75964199.03632398.07381592.292112738.333
144102412.35425649.41664197.66432395.32881581.310112650.483
145102412.26925649.07764196.31032392.62081570.479112563.836
146102412.18625648.74464194.97432389.94981559.796112478.367
147102412.10425648.41464193.65732387.31481549.257112394.054
148102412.02225648.08964192.35732384.71581538.859112310.872
149102411.94225647.76964191.07532382.15081528.600112228.800
150102411.86325647.45264189.81032379.61981518.477112147.815
151102411.78525647.14064188.56132377.12281508.487112067.895
152102411.70825646.83264187.32832374.65781498.627111989.020
153102411.63225646.52864186.11232372.22481488.896111911.169
154102411.55725646.22864184.91132369.82381479.290111834.323
155102411.48325645.93164183.72632367.45281469.808111758.462
156102411.41025645.63964182.55632365.11181460.446111683.567
157102411.33825645.35064181.40032362.80181451.203111609.620
158102411.26625645.06564180.25932360.51981442.075111536.604
159102411.19625644.78364179.13332358.26681433.062111464.500
160102411.12625644.50564178.02032356.04081424.161111393.292
161102411.05825644.23064176.92132353.84381415.370111322.963
162102410.99025643.95964175.83632351.67281406.687111253.497
163102410.92325643.69164174.76432349.52781398.110111184.878
164102410.85725643.42664173.70532347.40981389.636111117.091
165102410.79125643.16564172.65832345.31681381.265111050.120
166102410.72725642.90664171.62432343.24981372.994110983.952
167102410.66325642.65164170.60332341.20581364.821110918.571
168102410.60025642.39864169.59332339.18681356.746110853.964
169102410.53725642.14964168.59632337.19181348.765110790.118
170102410.47625641.90264167.61032335.21981340.877110727.018
171102410.41525641.65964166.63532333.27081333.081110664.651
172102410.35425641.41864165.67232331.34481325.376110603.006
173102410.29525641.18064164.72032329.44081317.759110542.069
174102410.23625640.94564163.77932327.55781310.229110481.829
175102410.17825640.71264162.84832325.69681302.784110422.273
176102410.12025640.48264161.92832323.85681295.424110363.390
177102410.06425640.25564161.01832322.03781288.146110305.169
178102410.00725640.03064160.11932320.23781280.950110247.598
17910249.95225639.80764159.22932318.45881273.833110190.667
18010249.89725639.58764158.34932316.69981266.796110134.365
18110249.84225639.37064157.47932314.95981259.835110078.681
18210249.78925639.15564156.61932313.23881252.951110023.607
18310249.73525638.94264155.76832311.53581246.14119969.130
18410249.68325638.73164154.92632309.85181239.40519915.243
18510249.63125638.52364154.09332308.18581232.74219861.935
18610249.57925638.31764153.26932306.53781226.15019809.198
18710249.52825638.11364152.45332304.90781219.62819757.021
18810249.47825637.91264151.64732303.29481213.17519705.397
18910249.42825637.71264150.84932301.69781206.78919654.316
19010249.37925637.51564150.05932300.11881200.47119603.770
19110249.33025637.31964149.27732298.55581194.21919553.750
19210249.28125637.12664148.50432297.00881188.03119504.249
19310249.23425636.93564147.73832295.47781181.90719455.258
19410249.18625636.74564146.98132293.96281175.84619406.769
19510249.13925636.55864146.23132292.46281169.84719358.776
19610249.09325636.37264145.48932290.97781163.90919311.269
19710249.04725636.18864144.75432289.50881158.03019264.242
19810249.00225636.00764144.02632288.05381152.21119217.688
19910248.95725635.82764143.30632286.61381146.45019171.600
20010248.91225635.64864142.59332285.18781140.74619125.970
20110248.86825635.47264141.88732283.77581135.09919080.792
20210248.82425635.29764141.18832282.37781129.50719036.059
20310248.78125635.12464140.49632280.99381123.97118991.765
20410248.73825634.95364139.81132279.62281118.48818947.902
20510248.69625634.78364139.13232278.26581113.05818904.466
20610248.65425634.61564138.46032276.92081107.68118861.449
20710248.61225634.44964137.79432275.58981102.35618818.846
20810248.57125634.28464137.13532274.27081097.08118776.651
20910248.53025634.12164136.48232272.96481091.85718734.857
21010248.49025633.95964135.83532271.67181086.68218693.460
21110248.45025633.79964135.19532270.38981081.55718652.453
21210248.41025633.64064134.56032269.12081076.47918611.831
21310248.37125633.48364133.93132267.86281071.44918571.589
21410248.33225633.32764133.30832266.61681066.46518531.721
21510248.29325633.17364132.69132265.38281061.52818492.222
21610248.25525633.02064132.07932264.15981056.63618453.088
21710248.21725632.86864131.47432262.94781051.78918414.312
21810248.18025632.71864130.87332261.74781046.98618375.890
21910248.14225632.57064130.27832260.55781042.22718337.818
22010248.10625632.42264129.68932259.37881037.51118300.090
22110248.06925632.27664129.10532258.20981032.83818262.703
22210248.03325632.13164128.52632257.05281028.20618225.650
22310247.99725631.98864127.95232255.90481023.61618188.929
22410247.96125631.84664127.38332254.76781019.06718152.533
22510247.92625631.70564126.82032253.63981014.55818116.460
22610247.89125631.56564126.26132252.52281010.08818080.705
22710247.85725631.42764125.70732251.41481005.65818045.263
22810247.82225631.29064125.15832250.31781001.26618010.131
22910247.78825631.15464124.61432249.2288996.91317975.304
23010247.75525631.01964124.07532248.1498992.59717940.779
23110247.72125630.88564123.54032247.0808988.31917906.552
23210247.68825630.75264123.01032246.0198984.07717872.618
23310247.65525630.62164122.48432244.9688979.87217838.974
23410247.62325630.49164121.96332243.9268975.70217805.617
23510247.59025630.36164121.44632242.8928971.56817772.542
23610247.55825630.23364120.93432241.8678967.46817739.747
23710247.52725630.10664120.42532240.8518963.40317707.227
23810247.49525629.98064119.92232239.8438959.37217674.979
23910247.46425629.85564119.42232238.8448955.37517643
24010247.43325629.73264118.92632237.8538951.41117611.286
24110247.40225629.60964118.43532236.8708947.47917579.835
24210247.37225629.48764117.94832235.8958943.58017548.642
24310247.34225629.36664117.46432234.9288939.71317517.705
24410247.31225629.24664116.98532233.9698935.87817487.020
24510247.28225629.12764116.50932233.0188932.07317456.585
24610247.25225629.00964116.03732232.0758928.30017426.397
24710247.22325628.89264115.57032231.1398924.55617396.452
24810247.19425628.77664115.10532230.2118920.84317366.747
24910247.16525628.66164114.64532229.2908917.16017337.280
25010247.13725628.54764114.18832228.3768913.50617308.048
25110247.10825628.43464113.73532227.4708909.88117279.048
25210247.08025628.32164113.28632226.5718906.28517250.277
25310247.05225628.21064112.84032225.6798902.71717221.732
25410247.02525628.09964112.39732224.7948899.17617193.412
25510246.99725627.99064111.95832223.9168895.66417165.312
w3cw3c
automatyka przemysłowa