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: 32768 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
01024322561286451232102484096132768
110241625664642563251282048116384
2102410.66725642.66764170.66732341.33381365.333110922.667
3102482563264128322568102418192
410246.40025625.60064102.40032204.8008819.20016553.600
510245.33325621.3336485.33332170.6678682.66715461.333
610244.57125618.2866473.14332146.2868585.14314681.143
71024425616646432128851214096
810243.55625614.2226456.88932113.7788455.11113640.889
910243.20025612.8006451.20032102.4008409.60013276.800
1010242.90925611.6366446.5453293.0918372.36412978.909
1110242.66725610.6676442.6673285.3338341.33312730.667
1210242.4622569.8466439.3853278.7698315.07712520.615
1310242.2862569.1436436.5713273.1438292.57112340.571
1410242.1332568.5336434.1333268.2678273.06712184.533
1510242256864323264825612048
1610241.8822567.5296430.1183260.2358240.94111927.529
1710241.7782567.1116428.4443256.8898227.55611820.444
1810241.6842566.7376426.9473253.8958215.57911724.632
1910241.6002566.4006425.6003251.2008204.80011638.400
2010241.5242566.0956424.3813248.7628195.04811560.381
2110241.4552565.8186423.2733246.5458186.18211489.455
2210241.3912565.5656422.2613244.5228178.08711424.696
2310241.3332565.3336421.3333242.6678170.66711365.333
2410241.2802565.1206420.4803240.9608163.84011310.720
2510241.2312564.9236419.6923239.3858157.53811260.308
2610241.1852564.7416418.9633237.9268151.70411213.630
2710241.1432564.5716418.2863236.5718146.28611170.286
2810241.1032564.4146417.6553235.3108141.24111129.931
2910241.0672564.2676417.0673234.1338136.53311092.267
3010241.0322564.1296416.5163233.0328132.12911057.032
3110241256464163232812811024
3210240.9702563.8796415.5153231.0308124.1211992.970
3310240.9412563.7656415.0593230.1188120.4711963.765
3410240.9142563.6576414.6293229.2578117.0291936.229
3510240.8892563.5566414.2223228.4448113.7781910.222
3610240.8652563.4596413.8383227.6768110.7031885.622
3710240.8422563.3686413.4743226.9478107.7891862.316
3810240.8212563.2826413.1283226.2568105.0261840.205
3910240.8002563.2006412.8003225.6008102.4001819.200
4010240.7802563.1226412.4883224.976899.9021799.220
4110240.7622563.0486412.1903224.381897.5241780.190
4210240.7442562.9776411.9073223.814895.2561762.047
4310240.7272562.9096411.6363223.273893.0911744.727
4410240.7112562.8446411.3783222.756891.0221728.178
4510240.6962562.7836411.1303222.261889.0431712.348
4610240.6812562.7236410.8943221.787887.1491697.191
4710240.6672562.6676410.6673221.333885.3331682.667
4810240.6532562.6126410.4493220.898883.5921668.735
4910240.6402562.5606410.2403220.480881.9201655.360
5010240.6272562.5106410.0393220.078880.3141642.510
5110240.6152562.462649.8463219.692878.7691630.154
5210240.6042562.415649.6603219.321877.2831618.264
5310240.5932562.370649.4813218.963875.8521606.815
5410240.5822562.327649.3093218.618874.4731595.782
5510240.5712562.286649.1433218.286873.1431585.143
5610240.5612562.246648.9823217.965871.8601574.877
5710240.5522562.207648.8283217.655870.6211564.966
5810240.5422562.169648.6783217.356869.4241555.390
5910240.5332562.133648.5333217.067868.2671546.133
6010240.5252562.098648.3933216.787867.1481537.180
6110240.5162562.065648.2583216.516866.0651528.516
6210240.5082562.032648.1273216.254865.0161520.127
6310240.500256264832168641512
6410240.4922561.969647.8773215.754863.0151504.123
6510240.4852561.939647.7583215.515862.0611496.485
6610240.4782561.910647.6423215.284861.1341489.075
6710240.4712561.882647.5293215.059860.2351481.882
6810240.4642561.855647.4203214.841859.3621474.899
6910240.4572561.829647.3143214.629858.5141468.114
7010240.4512561.803647.2113214.423857.6901461.521
7110240.4442561.778647.1113214.222856.8891455.111
7210240.4382561.753647.0143214.027856.1101448.877
7310240.4322561.730646.9193213.838855.3511442.811
7410240.4272561.707646.8273213.653854.6131436.907
7510240.4212561.684646.7373213.474853.8951431.158
7610240.4162561.662646.6493213.299853.1951425.558
7710240.4102561.641646.5643213.128852.5131420.103
7810240.4052561.620646.4813212.962851.8481414.785
7910240.4002561.600646.4003212.800851.2001409.600
8010240.3952561.580646.3213212.642850.5681404.543
8110240.3902561.561646.2443212.488849.9511399.610
8210240.3862561.542646.1693212.337849.3491394.795
8310240.3812561.524646.0953212.190848.7621390.095
8410240.3762561.506646.0243212.047848.1881385.506
8510240.3722561.488645.9533211.907847.6281381.023
8610240.3682561.471645.8853211.770847.0801376.644
8710240.3642561.455645.8183211.636846.5451372.364
8810240.3602561.438645.7533211.506846.0221368.180
8910240.3562561.422645.6893211.378845.5111364.089
9010240.3522561.407645.6263211.253845.0111360.088
9110240.3482561.391645.5653211.130844.5221356.174
9210240.3442561.376645.5053211.011844.0431352.344
9310240.3402561.362645.4473210.894843.5741348.596
9410240.3372561.347645.3893210.779843.1161344.926
9510240.3332561.333645.3333210.667842.6671341.333
9610240.3302561.320645.2783210.557842.2271337.814
9710240.3272561.306645.2243210.449841.7961334.367
9810240.3232561.293645.1723210.343841.3741330.990
9910240.3202561.280645.1203210.240840.9601327.680
10010240.3172561.267645.0693210.139840.5541324.436
10110240.3142561.255645.0203210.039840.1571321.255
10210240.3112561.243644.971329.942839.7671318.136
10310240.3082561.231644.923329.846839.3851315.077
10410240.3052561.219644.876329.752839.0101312.076
10510240.3022561.208644.830329.660838.6421309.132
10610240.2992561.196644.785329.570838.2801306.243
10710240.2962561.185644.741329.481837.9261303.407
10810240.2942561.174644.697329.394837.5781300.624
10910240.2912561.164644.655329.309837.2361297.891
11010240.2882561.153644.613329.225836.9011295.207
11110240.2862561.143644.571329.143836.5711292.571
11210240.2832561.133644.531329.062836.2481289.982
11310240.2812561.123644.491328.982835.9301287.439
11410240.2782561.113644.452328.904835.6171284.939
11510240.2762561.103644.414328.828835.3101282.483
11610240.2742561.094644.376328.752835.0091280.068
11710240.2712561.085644.339328.678834.7121277.695
11810240.2692561.076644.303328.605834.4201275.361
11910240.2672561.067644.267328.533834.1331273.067
12010240.2642561.058644.231328.463833.8511270.810
12110240.2622561.049644.197328.393833.5741268.590
12210240.2602561.041644.163328.325833.3011266.407
12310240.2582561.032644.129328.258833.0321264.258
12410240.2562561.024644.096328.192832.7681262.144
12510240.2542561.016644.063328.127832.5081260.063
12610240.2522561.008644.031328.063832.2521258.016
12710240.25025616443288321256
12810240.2482560.992643.969327.938831.7521254.016
12910240.2462560.985643.938327.877831.5081252.062
13010240.2442560.977643.908327.817831.2671250.137
13110240.2422560.970643.879327.758831.0301248.242
13210240.2412560.962643.850327.699830.7971246.376
13310240.2392560.955643.821327.642830.5671244.537
13410240.2372560.948643.793327.585830.3411242.726
13510240.2352560.941643.765327.529830.1181240.941
13610240.2342560.934643.737327.474829.8981239.182
13710240.2322560.928643.710327.420829.6811237.449
13810240.2302560.921643.683327.367829.4681235.741
13910240.2292560.914643.657327.314829.2571234.057
14010240.2272560.908643.631327.262829.0501232.397
14110240.2252560.901643.606327.211828.8451230.761
14210240.2242560.895643.580327.161828.6431229.147
14310240.2222560.889643.556327.111828.4441227.556
14410240.2212560.883643.531327.062828.2481225.986
14510240.2192560.877643.507327.014828.0551224.438
14610240.2182560.871643.483326.966827.8641222.912
14710240.2162560.865643.459326.919827.6761221.405
14810240.2152560.859643.436326.872827.4901219.919
14910240.2132560.853643.413326.827827.3071218.453
15010240.2122560.848643.391326.781827.1261217.007
15110240.2112560.842643.368326.737826.9471215.579
15210240.2092560.837643.346326.693826.7711214.170
15310240.2082560.831643.325326.649826.5971212.779
15410240.2062560.826643.303326.606826.4261211.406
15510240.2052560.821643.282326.564826.2561210.051
15610240.2042560.815643.261326.522826.0891208.713
15710240.2032560.810643.241326.481825.9241207.392
15810240.2012560.805643.220326.440825.7611206.088
15910240.2002560.800643.200326.400825.6001204.800
16010240.1992560.795643.180326.360825.4411203.528
16110240.1982560.790643.160326.321825.2841202.272
16210240.1962560.785643.141326.282825.1291201.031
16310240.1952560.780643.122326.244824.9761199.805
16410240.1942560.776643.103326.206824.8241198.594
16510240.1932560.771643.084326.169824.6751197.398
16610240.1922560.766643.066326.132824.5271196.216
16710240.1902560.762643.048326.095824.3811195.048
16810240.1892560.757643.030326.059824.2371193.893
16910240.1882560.753643.012326.024824.0941192.753
17010240.1872560.749642.994325.988823.9531191.626
17110240.1862560.744642.977325.953823.8141190.512
17210240.1852560.740642.960325.919823.6761189.410
17310240.1842560.736642.943325.885823.5401188.322
17410240.1832560.731642.926325.851823.4061187.246
17510240.1822560.727642.909325.818823.2731186.182
17610240.1812560.723642.893325.785823.1411185.130
17710240.1802560.719642.876325.753823.0111184.090
17810240.1792560.715642.860325.721822.8831183.061
17910240.1782560.711642.844325.689822.7561182.044
18010240.1772560.707642.829325.657822.6301181.039
18110240.1762560.703642.813325.626822.5051180.044
18210240.1752560.699642.798325.596822.3831179.060
18310240.1742560.696642.783325.565822.2611178.087
18410240.1732560.692642.768325.535822.1411177.124
18510240.1722560.688642.753325.505822.0221176.172
18610240.1712560.684642.738325.476821.9041175.230
18710240.1702560.681642.723325.447821.7871174.298
18810240.1692560.677642.709325.418821.6721173.376
18910240.1682560.674642.695325.389821.5581172.463
19010240.1682560.670642.681325.361821.4451171.560
19110240.1672560.667642.667325.333821.3331170.667
19210240.1662560.663642.653325.306821.2231169.782
19310240.1652560.660642.639325.278821.1131168.907
19410240.1642560.656642.626325.251821.0051168.041
19510240.1632560.653642.612325.224820.8981167.184
19610240.1622560.650642.599325.198820.7921166.335
19710240.1622560.646642.586325.172820.6871165.495
19810240.1612560.643642.573325.146820.5831164.663
19910240.1602560.640642.560325.120820.4801163.840
20010240.1592560.637642.547325.095820.3781163.025
20110240.1582560.634642.535325.069820.2771162.218
20210240.1582560.631642.522325.044820.1771161.419
20310240.1572560.627642.510325.020820.0781160.627
20410240.1562560.624642.498324.995819.9801159.844
20510240.1552560.621642.485324.971819.8831159.068
20610240.1552560.618642.473324.947819.7871158.300
20710240.1542560.615642.462324.923819.6921157.538
20810240.1532560.612642.450324.900819.5981156.785
20910240.1522560.610642.438324.876819.5051156.038
21010240.1522560.607642.427324.853819.4121155.299
21110240.1512560.604642.415324.830819.3211154.566
21210240.1502560.601642.404324.808819.2301153.840
21310240.1502560.598642.393324.785819.1401153.121
21410240.1492560.595642.381324.763819.0511152.409
21510240.1482560.593642.370324.741818.9631151.704
21610240.1472560.590642.359324.719818.8761151.005
21710240.1472560.587642.349324.697818.7891150.312
21810240.1462560.584642.338324.676818.7031149.626
21910240.1452560.582642.327324.655818.6181148.945
22010240.1452560.579642.317324.633818.5341148.271
22110240.1442560.577642.306324.613818.4501147.604
22210240.1432560.574642.296324.592818.3681146.942
22310240.1432560.571642.286324.571818.2861146.286
22410240.1422560.569642.276324.551818.2041145.636
22510240.1422560.566642.265324.531818.1241144.991
22610240.1412560.564642.256324.511818.0441144.352
22710240.1402560.561642.246324.491817.9651143.719
22810240.1402560.559642.236324.472817.8861143.092
22910240.1392560.557642.226324.452817.8091142.470
23010240.1392560.554642.216324.433817.7321141.853
23110240.1382560.552642.207324.414817.6551141.241
23210240.1372560.549642.197324.395817.5791140.635
23310240.1372560.547642.188324.376817.5041140.034
23410240.1362560.545642.179324.357817.4301139.438
23510240.1362560.542642.169324.339817.3561138.847
23610240.1352560.540642.160324.321817.2831138.262
23710240.1342560.538642.151324.303817.2101137.681
23810240.1342560.536642.142324.285817.1381137.105
23910240.1332560.533642.133324.267817.0671136.533
24010240.1332560.531642.124324.249816.9961135.967
24110240.1322560.529642.116324.231816.9261135.405
24210240.1322560.527642.107324.214816.8561134.848
24310240.1312560.525642.098324.197816.7871134.295
24410240.1312560.522642.090324.180816.7181133.747
24510240.1302560.520642.081324.163816.6501133.203
24610240.1302560.518642.073324.146816.5831132.664
24710240.1292560.516642.065324.129816.5161132.129
24810240.1292560.514642.056324.112816.4501131.598
24910240.1282560.512642.048324.096816.3841131.072
25010240.1272560.510642.040324.080816.3191130.550
25110240.1272560.508642.032324.063816.2541130.032
25210240.1262560.506642.024324.047816.1901129.518
25310240.1262560.504642.016324.031816.1261129.008
25410240.1252560.502642.008324.016816.0631128.502
25510240.1252560.5006423248161128
w3cw3c
automatyka przemysłowa