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: 1000000 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
01024976.5622563906.25064156253231250812500011000000
11024488.2812561953.125647812.50032156258625001500000
21024325.5212561302.083645208.3333210416.667841666.6671333333.333
31024244.141256976.562643906.250327812.5008312501250000
41024195.312256781.2506431253262508250001200000
51024162.760256651.042642604.167325208.333820833.3331166666.667
61024139.509256558.036642232.143324464.286817857.1431142857.143
71024122.070256488.281641953.125323906.2508156251125000
81024108.507256434.028641736.111323472.222813888.8891111111.111
9102497.656256390.625641562.5003231258125001100000
10102488.778256355.114641420.455322840.909811363.636190909.091
11102481.380256325.521641302.083322604.167810416.667183333.333
12102475.120256300.481641201.923322403.84689615.385176923.077
13102469.754256279.018641116.071322232.14388928.571171428.571
14102465.104256260.417641041.667322083.33388333.333166666.667
15102461.035256244.14164976.562321953.12587812.500162500
16102457.445256229.77964919.118321838.23587352.941158823.529
17102454.253256217.01464868.056321736.11186944.444155555.556
18102451.398256205.59264822.368321644.73786578.947152631.579
19102448.828256195.31264781.250321562.50086250150000
20102446.503256186.01264744.048321488.09585952.381147619.048
21102444.389256177.55764710.227321420.45585681.818145454.545
22102442.459256169.83764679.348321358.69685434.783143478.261
23102440.690256162.76064651.042321302.08385208.333141666.667
24102439.062256156.2506462532125085000140000
25102437.560256150.24064600.962321201.92384807.692138461.538
26102436.169256144.67664578.704321157.40784629.630137037.037
27102434.877256139.50964558.036321116.07184464.286135714.286
28102433.675256134.69864538.793321077.58684310.345134482.759
29102432.552256130.20864520.833321041.66784166.667133333.333
30102431.502256126.00864504.032321008.06584032.258132258.065
31102430.518256122.07064488.28132976.56283906.250131250
32102429.593256118.37164473.48532946.97083787.879130303.030
33102428.722256114.89064459.55932919.11883676.471129411.765
34102427.902256111.60764446.42932892.85783571.429128571.429
35102427.127256108.50764434.02832868.05683472.222127777.778
36102426.394256105.57464422.29732844.59583378.378127027.027
37102425.699256102.79664411.18432822.36883289.474126315.789
38102425.040256100.16064400.64132801.28283205.128125641.026
39102424.41425697.65664390.62532781.25083125125000
40102423.81925695.27464381.09832762.19583048.780124390.244
41102423.25125693.00664372.02432744.04882976.190123809.524
42102422.71125690.84364363.37232726.74482906.977123255.814
43102422.19525688.77864355.11432710.22782840.909122727.273
44102421.70125686.80664347.22232694.44482777.778122222.222
45102421.23025684.91864339.67432679.34882717.391121739.130
46102420.77825683.11264332.44732664.89482659.574121276.596
47102420.34525681.38064325.52132651.04282604.167120833.333
48102419.93025679.71964318.87832637.75582551.020120408.163
49102419.53125678.12564312.5003262582500120000
50102419.14825676.59364306.37332612.74582450.980119607.843
51102418.78025675.12064300.48132600.96282403.846119230.769
52102418.42625673.70364294.81132589.62382358.491118867.925
53102418.08425672.33864289.35232578.70482314.815118518.519
54102417.75625671.02364284.09132568.18282272.727118181.818
55102417.43925669.75464279.01832558.03682232.143117857.143
56102417.13325668.53164274.12332548.24682192.982117543.860
57102416.83725667.34964269.39732538.79382155.172117241.379
58102416.55225666.20864264.83132529.66182118.644116949.153
59102416.27625665.10464260.41732520.83382083.333116666.667
60102416.00925664.03764256.14832512.29582049.180116393.443
61102415.75125663.00464252.01632504.03282016.129116129.032
62102415.50125662.00464248.01632496.03281984.127115873.016
63102415.25925661.03564244.14132488.28181953.125115625
64102415.02425660.09664240.38532480.76981923.077115384.615
65102414.79625659.18664236.74232473.48581893.939115151.515
66102414.57625658.30264233.20932466.41881865.672114925.373
67102414.36125657.44564229.77932459.55981838.235114705.882
68102414.15325656.61264226.44932452.89981811.594114492.754
69102413.95125655.80464223.21432446.42981785.714114285.714
70102413.75425655.01864220.07032440.14181760.563114084.507
71102413.56325654.25364217.01432434.02881736.111113888.889
72102413.37825653.51064214.04132428.08281712.329113698.630
73102413.19725652.78764211.14932422.29781689.189113513.514
74102413.02125652.08364208.33332416.66781666.667113333.333
75102412.85025651.39864205.59232411.18481644.737113157.895
76102412.68325650.73164202.92232405.84481623.377112987.013
77102412.52025650.08064200.32132400.64181602.564112820.513
78102412.36225649.44664197.78532395.57081582.278112658.228
79102412.20725648.82864195.31232390.62581562.500112500
80102412.05625648.22564192.90132385.80281543.210112345.679
81102411.90925647.63764190.54932381.09881524.390112195.122
82102411.76625647.06364188.25332376.50681506.024112048.193
83102411.62625646.50364186.01232372.02481488.095111904.762
84102411.48925645.95664183.82432367.64781470.588111764.706
85102411.35525645.42264181.68632363.37281453.488111627.907
86102411.22525644.89964179.59832359.19581436.782111494.253
87102411.09725644.38964177.55732355.11481420.455111363.636
88102410.97325643.89064175.56232351.12481404.494111235.955
89102410.85125643.40364173.61132347.22281388.889111111.111
90102410.73125642.92664171.70332343.40781373.626110989.011
91102410.61525642.45964169.83732339.67481358.696110869.565
92102410.50125642.00364168.01132336.02281344.086110752.688
93102410.38925641.55664166.22332332.44781329.787110638.298
94102410.28025641.11864164.47432328.94781315.789110526.316
95102410.17325640.69064162.76032325.52181302.083110416.667
96102410.06825640.27164161.08232322.16581288.660110309.278
9710249.96525639.86064159.43932318.87881275.510110204.082
9810249.86425639.45764157.82832315.65781262.626110101.010
9910249.76625639.06264156.25032312.50081250110000
10010249.66925638.67664154.70332309.40681237.62419900.990
10110249.57425638.29764153.18632306.37381225.49019803.922
10210249.48125637.92564151.69932303.39881213.59219708.738
10310249.39025637.56064150.24032300.48181201.92319615.385
10410249.30125637.20264148.81032297.61981190.47619523.810
10510249.21325636.85164147.40632294.81181179.24519433.962
10610249.12725636.50764146.02832292.05681168.22419345.794
10710249.04225636.16964144.67632289.35281157.40719259.259
10810248.95925635.83764143.34932286.69781146.78919174.312
10910248.87825635.51164142.04532284.09181136.36419090.909
11010248.79825635.19164140.76632281.53281126.12619009.009
11110248.71925634.87764139.50932279.01881116.07118928.571
11210248.64225634.56964138.27432276.54981106.19518849.558
11310248.56625634.26564137.06132274.12381096.49118771.930
11410248.49225633.96764135.87032271.73981086.95718695.652
11510248.41925633.67564134.69832269.39781077.58618620.690
11610248.34725633.38764133.54732267.09481068.37618547.009
11710248.27625633.10464132.41532264.83181059.32218474.576
11810248.20625632.82664131.30332262.60581050.42018403.361
11910248.13825632.55264130.20832260.41781041.66718333.333
12010248.07125632.28364129.13232258.26481033.05818264.463
12110248.00525632.01864128.07432256.14881024.59018196.721
12210247.94025631.75864127.03332254.06581016.26018130.081
12310247.87625631.50264126.00832252.01681008.06518064.516
12410247.81225631.25064125322508100018000
12510247.75025631.00264124.00832248.0168992.06317936.508
12610247.68925630.75864123.03132246.0638984.25217874.016
12710247.62925630.51864122.07032244.1418976.56217812.500
12810247.57025630.28164121.12432242.2488968.99217751.938
12910247.51225630.04864120.19232240.3858961.53817692.308
13010247.45525629.81964119.27532238.5508954.19817633.588
13110247.39825629.59364118.37132236.7428946.97017575.758
13210247.34325629.37064117.48132234.9628939.85017518.797
13310247.28825629.15164116.60432233.2098932.83617462.687
13410247.23425628.93564115.74132231.4818925.92617407.407
13510247.18125628.72264114.89032229.7798919.11817352.941
13610247.12825628.51364114.05132228.1028912.40917299.270
13710247.07725628.30664113.22532226.4498905.79717246.377
13810247.02625628.10364112.41032224.8208899.28117194.245
13910246.97525627.90264111.60732223.2148892.85717142.857
14010246.92625627.70464110.81632221.6318886.52517092.199
14110246.87725627.50964110.03532220.0708880.28217042.254
14210246.82925627.31664109.26632218.5318874.12616993.007
14310246.78225627.12764108.50732217.0148868.05616944.444
14410246.73525626.94064107.75932215.5178862.06916896.552
14510246.68925626.75564107.02132214.0418856.16416849.315
14610246.64325626.57364106.29332212.5858850.34016802.721
14710246.59825626.39464105.57432211.1498844.59516756.757
14810246.55425626.21664104.86632209.7328838.92616711.409
14910246.51025626.04264104.16732208.3338833.33316666.667
15010246.46725625.86964103.47732206.9548827.81516622.517
15110246.42525625.69964102.79632205.5928822.36816578.947
15210246.38325625.53164102.12432204.2488816.99316535.948
15310246.34125625.36564101.46132202.9228811.68816493.506
15410246.30025625.20264100.80632201.6138806.45216451.613
15510246.26025625.04064100.16032200.3218801.28216410.256
15610246.22025624.8816499.52232199.0458796.17816369.427
15710246.18125624.7236498.89232197.7858791.13916329.114
15810246.14225624.5686498.27032196.5418786.16416289.308
15910246.10425624.4146497.65632195.3128781.25016250
16010246.06625624.2626497.05032194.0998776.39816211.180
16110246.02825624.1136496.45132192.9018771.60516172.840
16210245.99125623.9656495.85932191.7188766.87116134.969
16310245.95525623.8196495.27432190.5498762.19516097.561
16410245.91925623.6746494.69732189.3948757.57616060.606
16510245.88325623.5326494.12732188.2538753.01216024.096
16610245.84825623.3916493.56332187.1268748.50315988.024
16710245.81325623.2516493.00632186.0128744.04815952.381
16810245.77825623.1146492.45632184.9118739.64515917.160
16910245.74425622.9786491.91232183.8248735.29415882.353
17010245.71125622.8446491.37432182.7498730.99415847.953
17110245.67825622.7116490.84332181.6868726.74415813.953
17210245.64525622.5796490.31832180.6368722.54315780.347
17310245.61225622.4506489.79932179.5988718.39115747.126
17410245.58025622.3216489.28632178.5718714.28615714.286
17510245.54925622.1956488.77832177.5578710.22715681.818
17610245.51725622.0696488.27732176.5548706.21515649.718
17710245.48625621.9456487.78132175.5628702.24715617.978
17810245.45625621.8236487.29132174.5818698.32415586.592
17910245.42525621.7016486.80632173.6118694.44415555.556
18010245.39525621.5816486.32632172.6528690.60815524.862
18110245.36625621.4636485.85232171.7038686.81315494.505
18210245.33625621.3466485.38332170.7658683.06015464.481
18310245.30725621.2306484.91832169.8378679.34815434.783
18410245.27925621.1156484.45932168.9198675.67615405.405
18510245.25025621.0016484.00532168.0118672.04315376.344
18610245.22225620.8896483.55632167.1128668.44915347.594
18710245.19425620.7786483.11232166.2238664.89415319.149
18810245.16725620.6686482.67232165.3448661.37615291.005
18910245.14025620.5596482.23732164.4748657.89515263.158
19010245.11325620.4526481.80632163.6138654.45015235.602
19110245.08625620.3456481.38032162.7608651.04215208.333
19210245.06025620.2406480.95932161.9178647.66815181.347
19310245.03425620.1356480.54132161.0828644.33015154.639
19410245.00825620.0326480.12832160.2568641.02615128.205
19510244.98225619.9306479.71932159.4398637.75515102.041
19610244.95725619.8296479.31532158.6298634.51815076.142
19710244.93225619.7296478.91432157.8288631.31315050.505
19810244.90725619.6296478.51832157.0358628.14115025.126
19910244.88325619.5316478.12532156.250862515000
20010244.85925619.4346477.73632155.4738621.89114975.124
20110244.83425619.3386477.35132154.7038618.81214950.495
20210244.81125619.2436476.97032153.9418615.76414926.108
20310244.78725619.1486476.59332153.1868612.74514901.961
20410244.76425619.0556476.22032152.4398609.75614878.049
20510244.74125618.9626475.85032151.6998606.79614854.369
20610244.71825618.8716475.48332150.9668603.86514830.918
20710244.69525618.7806475.12032150.2408600.96214807.692
20810244.67325618.6906474.76132149.5228598.08614784.689
20910244.65025618.6016474.40532148.8108595.23814761.905
21010244.62825618.5136474.05232148.1048592.41714739.336
21110244.60625618.4266473.70332147.4068589.62314716.981
21210244.58525618.3396473.35732146.7148586.85414694.836
21310244.56325618.2546473.01432146.0288584.11214672.897
21410244.54225618.1696472.67432145.3498581.39514651.163
21510244.52125618.0846472.33832144.6768578.70414629.630
21610244.50025618.0016472.00532144.0098576.03714608.295
21710244.48025617.9196471.67432143.3498573.39414587.156
21810244.45925617.8376471.34732142.6948570.77614566.210
21910244.43925617.7566471.02332142.0458568.18214545.455
22010244.41925617.6756470.70132141.4038565.61114524.887
22110244.39925617.5966470.38332140.7668563.06314504.505
22210244.37925617.5176470.06732140.1358560.53814484.305
22310244.36025617.4396469.75432139.5098558.03614464.286
22410244.34025617.3616469.44432138.8898555.55614444.444
22510244.32125617.2846469.13732138.2748553.09714424.779
22610244.30225617.2086468.83332137.6658550.66114405.286
22710244.28325617.1336468.53132137.0618548.24614385.965
22810244.26425617.0586468.23132136.4638545.85214366.812
22910244.24625616.9846467.93532135.8708543.47814347.826
23010244.22825616.9106467.64132135.2818541.12614329.004
23110244.20925616.8376467.34932134.6988538.79314310.345
23210244.19125616.7656467.06032134.1208536.48114291.845
23310244.17325616.6936466.77432133.5478534.18814273.504
23410244.15625616.6226466.48932132.9798531.91514255.319
23510244.13825616.5526466.20832132.4158529.66114237.288
23610244.12125616.4826465.92832131.8578527.42614219.409
23710244.10325616.4136465.65132131.3038525.21014201.681
23810244.08625616.3446465.37732130.7538523.01314184.100
23910244.06925616.2766465.10432130.2088520.83314166.667
24010244.05225616.2096464.83432129.6688518.67214149.378
24110244.03525616.1426464.56632129.1328516.52914132.231
24210244.01925616.0756464.30032128.6018514.40314115.226
24310244.00225616.0096464.03732128.0748512.29514098.361
24410243.98625615.9446463.77632127.5518510.20414081.633
24510243.97025615.8796463.51632127.0338508.13014065.041
24610243.95425615.8156463.25932126.5188506.07314048.583
24710243.93825615.7516463.00432126.0088504.03214032.258
24810243.92225615.6886462.75132125.5028502.00814016.064
24910243.90625615.6256462.50032125850014000
25010243.89125615.5636462.25132124.5028498.00813984.064
25110243.87525615.5016462.00432124.0088496.03213968.254
25210243.86025615.4406461.75932123.5188494.07113952.569
25310243.84525615.3796461.51632123.0318492.12613937.008
25410243.83025615.3196461.27532122.5498490.19613921.569
25510243.81525615.2596461.03532122.0708488.28113906.250
w3cw3c
automatyka przemysłowa