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: 32700 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
0102431.934256127.73464510.938321021.87584087.500132700
1102415.96725663.86764255.46932510.93882043.750116350
2102410.64525642.57864170.31232340.62581362.500110900
310247.98325631.93464127.73432255.46981021.87518175
410246.38725625.54764102.18832204.3758817.50016540
510245.32225621.2896485.15632170.3128681.25015450
610244.56225618.2486472.99132145.9828583.92914671.429
710243.99225615.9676463.86732127.7348510.93814087.500
810243.54825614.1936456.77132113.5428454.16713633.333
910243.19325612.7736451.09432102.1888408.75013270
1010242.90325611.6126446.4493292.8988371.59112972.727
1110242.66125610.6456442.5783285.1568340.62512725
1210242.4562569.8266439.3033278.6068314.42312515.385
1310242.2812569.1246436.4963272.9918291.96412335.714
1410242.1292568.5166434.0623268.1258272.50012180
1510241.9962567.9836431.9343263.8678255.46912043.750
1610241.8782567.5146430.0553260.1108240.44111923.529
1710241.7742567.0966428.3853256.7718227.08311816.667
1810241.6812566.7236426.8913253.7838215.13211721.053
1910241.5972566.3876425.5473251.0948204.37511635
2010241.5212566.0836424.3303248.6618194.64311557.143
2110241.4522565.8066423.2243246.4498185.79511486.364
2210241.3882565.5546422.2153244.4298177.71711421.739
2310241.3312565.3226421.2893242.5788170.31211362.500
2410241.2772565.1096420.4383240.8758163.50011308
2510241.2282564.9136419.6513239.3038157.21211257.692
2610241.1832564.7316418.9243237.8478151.38911211.111
2710241.1402564.5626418.2483236.4968145.98211167.857
2810241.1012564.4056417.6193235.2378140.94811127.586
2910241.0642564.2586417.0313234.0628136.25011090
3010241.0302564.1206416.4823232.9648131.85511054.839
3110240.9982563.9926415.9673231.9348127.73411021.875
3210240.9682563.8716415.4833230.9668123.8641990.909
3310240.9392563.7576415.0283230.0558120.2211961.765
3410240.9122563.6506414.5983229.1968116.7861934.286
3510240.8872563.5486414.1933228.3858113.5421908.333
3610240.8632563.4526413.8093227.6188110.4731883.784
3710240.8402563.3616413.4463226.8918107.5661860.526
3810240.8192563.2756413.1013226.2028104.8081838.462
3910240.7982563.1936412.7733225.5478102.1881817.500
4010240.7792563.1156412.4623224.924899.6951797.561
4110240.7602563.0416412.1653224.330897.3211778.571
4210240.7432562.9716411.8823223.765895.0581760.465
4310240.7262562.9036411.6123223.224892.8981743.182
4410240.7102562.8396411.3543222.708890.8331726.667
4510240.6942562.7776411.1073222.215888.8591710.870
4610240.6792562.7186410.8713221.742886.9681695.745
4710240.6652562.6616410.6453221.289885.1561681.250
4810240.6522562.6076410.4273220.855883.4181667.347
4910240.6392562.5556410.2193220.438881.7501654
5010240.6262562.5056410.0183220.037880.1471641.176
5110240.6142562.456649.8263219.651878.6061628.846
5210240.6032562.410649.6403219.281877.1231616.981
5310240.5912562.365649.4623218.924875.6941605.556
5410240.5812562.322649.2903218.580874.3181594.545
5510240.5702562.281649.1243218.248872.9911583.929
5610240.5602562.241648.9643217.928871.7111573.684
5710240.5512562.202648.8093217.619870.4741563.793
5810240.5412562.165648.6603217.320869.2801554.237
5910240.5322562.129648.5163217.031868.1251545
6010240.5242562.094648.3763216.752867.0081536.066
6110240.5152562.060648.2413216.482865.9271527.419
6210240.5072562.028648.1103216.220864.8811519.048
6310240.4992561.996647.9833215.967863.8671510.938
6410240.4912561.965647.8613215.721862.8851503.077
6510240.4842561.935647.7413215.483861.9321495.455
6610240.4772561.906647.6263215.252861.0071488.060
6710240.4702561.878647.5143215.028860.1101480.882
6810240.4632561.851647.4053214.810859.2391473.913
6910240.4562561.825647.2993214.598858.3931467.143
7010240.4502561.799647.1963214.393857.5701460.563
7110240.4442561.774647.0963214.193856.7711454.167
7210240.4372561.750646.9993213.998855.9931447.945
7310240.4322561.726646.9053213.809855.2361441.892
7410240.4262561.703646.8123213.625854.5001436
7510240.4202561.681646.7233213.446853.7831430.263
7610240.4152561.659646.6363213.271853.0841424.675
7710240.4092561.638646.5503213.101852.4041419.231
7810240.4042561.617646.4683212.935851.7411413.924
7910240.3992561.597646.3873212.773851.0941408.750
8010240.3942561.577646.3083212.616850.4631403.704
8110240.3892561.558646.2313212.462849.8481398.780
8210240.3852561.539646.1563212.312849.2471393.976
8310240.3802561.521646.0833212.165848.6611389.286
8410240.3762561.503646.0113212.022848.0881384.706
8510240.3712561.485645.9413211.882847.5291380.233
8610240.3672561.468645.8733211.746846.9831375.862
8710240.3632561.452645.8063211.612846.4491371.591
8810240.3592561.435645.7413211.482845.9271367.416
8910240.3552561.419645.6773211.354845.4171363.333
9010240.3512561.404645.6153211.229844.9181359.341
9110240.3472561.388645.5543211.107844.4291355.435
9210240.3432561.373645.4943210.988843.9521351.613
9310240.3402561.359645.4363210.871843.4841347.872
9410240.3362561.345645.3783210.757843.0261344.211
9510240.3332561.331645.3223210.645842.5781340.625
9610240.3292561.317645.2673210.535842.1391337.113
9710240.3262561.303645.2143210.427841.7091333.673
9810240.3232561.290645.1613210.322841.2881330.303
9910240.3192561.277645.1093210.219840.8751327
10010240.3162561.265645.0593210.118840.4701323.762
10110240.3132561.252645.0093210.018840.0741320.588
10210240.3102561.240644.961329.921839.6841317.476
10310240.3072561.228644.913329.826839.3031314.423
10410240.3042561.217644.866329.732838.9291311.429
10510240.3012561.205644.820329.640838.5611308.491
10610240.2982561.194644.775329.550838.2011305.607
10710240.2962561.183644.731329.462837.8471302.778
10810240.2932561.172644.688329.375837.5001300
10910240.2902561.161644.645329.290837.1591297.273
11010240.2882561.151644.603329.206836.8241294.595
11110240.2852561.140644.562329.124836.4961291.964
11210240.2832561.130644.522329.043836.1731289.381
11310240.2802561.120644.482328.964835.8551286.842
11410240.2782561.111644.443328.886835.5431284.348
11510240.2752561.101644.405328.809835.2371281.897
11610240.2732561.092644.367328.734834.9361279.487
11710240.2712561.082644.330328.660834.6401277.119
11810240.2682561.073644.294328.587834.3491274.790
11910240.2662561.064644.258328.516834.0621272.500
12010240.2642561.056644.223328.445833.7811270.248
12110240.2622561.047644.188328.376833.5041268.033
12210240.2602561.038644.154328.308833.2321265.854
12310240.2582561.030644.120328.241832.9641263.710
12410240.2552561.022644.088328.175832.7001261.600
12510240.2532561.014644.055328.110832.4401259.524
12610240.2512561.006644.023328.046832.1851257.480
12710240.2492560.998643.992327.983831.9341255.469
12810240.2482560.990643.961327.922831.6861253.488
12910240.2462560.983643.930327.861831.4421251.538
13010240.2442560.975643.900327.801831.2021249.618
13110240.2422560.968643.871327.741830.9661247.727
13210240.2402560.960643.842327.683830.7331245.865
13310240.2382560.953643.813327.626830.5041244.030
13410240.2372560.946643.785327.569830.2781242.222
13510240.2352560.939643.757327.514830.0551240.441
13610240.2332560.932643.729327.459829.8361238.686
13710240.2312560.926643.702327.405829.6201236.957
13810240.2302560.919643.676327.352829.4061235.252
13910240.2282560.912643.650327.299829.1961233.571
14010240.2262560.906643.624327.247828.9891231.915
14110240.2252560.900643.598327.196828.7851230.282
14210240.2232560.893643.573327.146828.5841228.671
14310240.2222560.887643.548327.096828.3851227.083
14410240.2202560.881643.524327.047828.1901225.517
14510240.2192560.875643.500326.999827.9971223.973
14610240.2172560.869643.476326.952827.8061222.449
14710240.2162560.863643.452326.905827.6181220.946
14810240.2142560.857643.429326.858827.4331219.463
14910240.2132560.852643.406326.812827.2501218
15010240.2112560.846643.384326.767827.0701216.556
15110240.2102560.840643.361326.723826.8911215.132
15210240.2092560.835643.339326.679826.7161213.725
15310240.2072560.829643.318326.636826.5421212.338
15410240.2062560.824643.296326.593826.3711210.968
15510240.2052560.819643.275326.550826.2021209.615
15610240.2032560.814643.254326.509826.0351208.280
15710240.2022560.808643.234326.468825.8701206.962
15810240.2012560.803643.213326.427825.7081205.660
15910240.2002560.798643.193326.387825.5471204.375
16010240.1982560.793643.174326.347825.3881203.106
16110240.1972560.788643.154326.308825.2311201.852
16210240.1962560.784643.135326.269825.0771200.613
16310240.1952560.779643.115326.231824.9241199.390
16410240.1942560.774643.097326.193824.7731198.182
16510240.1922560.769643.078326.156824.6231196.988
16610240.1912560.765643.060326.119824.4761195.808
16710240.1902560.760643.041326.083824.3301194.643
16810240.1892560.756643.023326.047824.1861193.491
16910240.1882560.751643.006326.011824.0441192.353
17010240.1872560.747642.988325.976823.9041191.228
17110240.1862560.743642.971325.941823.7651190.116
17210240.1852560.738642.953325.907823.6271189.017
17310240.1842560.734642.936325.873823.4911187.931
17410240.1822560.730642.920325.839823.3571186.857
17510240.1812560.726642.903325.806823.2241185.795
17610240.1802560.722642.887325.773823.0931184.746
17710240.1792560.718642.870325.741822.9631183.708
17810240.1782560.714642.854325.709822.8351182.682
17910240.1772560.710642.839325.677822.7081181.667
18010240.1762560.706642.823325.646822.5831180.663
18110240.1752560.702642.807325.615822.4591179.670
18210240.1752560.698642.792325.584822.3361178.689
18310240.1742560.694642.777325.554822.2151177.717
18410240.1732560.690642.762325.524822.0951176.757
18510240.1722560.687642.747325.494821.9761175.806
18610240.1712560.683642.732325.465821.8581174.866
18710240.1702560.679642.718325.436821.7421173.936
18810240.1692560.676642.703325.407821.6271173.016
18910240.1682560.672642.689325.378821.5131172.105
19010240.1672560.669642.675325.350821.4011171.204
19110240.1662560.665642.661325.322821.2891170.312
19210240.1652560.662642.647325.295821.1791169.430
19310240.1652560.658642.634325.267821.0701168.557
19410240.1642560.655642.620325.240820.9621167.692
19510240.1632560.652642.607325.214820.8551166.837
19610240.1622560.648642.594325.187820.7491165.990
19710240.1612560.645642.580325.161820.6441165.152
19810240.1602560.642642.568325.135820.5401164.322
19910240.1602560.639642.555325.109820.4381163.500
20010240.1592560.635642.542325.084820.3361162.687
20110240.1582560.632642.529325.059820.2351161.881
20210240.1572560.629642.517325.034820.1351161.084
20310240.1572560.626642.505325.009820.0371160.294
20410240.1562560.623642.492324.985819.9391159.512
20510240.1552560.620642.480324.961819.8421158.738
20610240.1542560.617642.468324.937819.7461157.971
20710240.1542560.614642.456324.913819.6511157.212
20810240.1532560.611642.445324.889819.5571156.459
20910240.1522560.608642.433324.866819.4641155.714
21010240.1512560.605642.422324.843819.3721154.976
21110240.1512560.603642.410324.820819.2811154.245
21210240.1502560.600642.399324.798819.1901153.521
21310240.1492560.597642.388324.775819.1001152.804
21410240.1492560.594642.376324.753819.0121152.093
21510240.1482560.591642.365324.731818.9241151.389
21610240.1472560.589642.355324.709818.8361150.691
21710240.1462560.586642.344324.688818.7501150
21810240.1462560.583642.333324.666818.6641149.315
21910240.1452560.581642.322324.645818.5801148.636
22010240.1442560.578642.312324.624818.4951147.964
22110240.1442560.575642.302324.603818.4121147.297
22210240.1432560.573642.291324.582818.3301146.637
22310240.1432560.570642.281324.562818.2481145.982
22410240.1422560.568642.271324.542818.1671145.333
22510240.1412560.565642.261324.522818.0861144.690
22610240.1412560.563642.251324.502818.0071144.053
22710240.1402560.560642.241324.482817.9281143.421
22810240.1392560.558642.231324.462817.8491142.795
22910240.1392560.555642.221324.443817.7721142.174
23010240.1382560.553642.212324.424817.6951141.558
23110240.1382560.551642.202324.405817.6191140.948
23210240.1372560.548642.193324.386817.5431140.343
23310240.1362560.546642.183324.367817.4681139.744
23410240.1362560.544642.174324.348817.3941139.149
23510240.1352560.541642.165324.330817.3201138.559
23610240.1352560.539642.156324.312817.2471137.975
23710240.1342560.537642.147324.294817.1741137.395
23810240.1342560.534642.138324.276817.1031136.820
23910240.1332560.532642.129324.258817.0311136.250
24010240.1332560.530642.120324.240816.9611135.685
24110240.1322560.528642.111324.223816.8901135.124
24210240.1312560.526642.103324.205816.8211134.568
24310240.1312560.524642.094324.188816.7521134.016
24410240.1302560.521642.085324.171816.6841133.469
24510240.1302560.519642.077324.154816.6161132.927
24610240.1292560.517642.069324.137816.5491132.389
24710240.1292560.515642.060324.120816.4821131.855
24810240.1282560.513642.052324.104816.4161131.325
24910240.1282560.511642.044324.088816.3501130.800
25010240.1272560.509642.036324.071816.2851130.279
25110240.1272560.507642.028324.055816.2201129.762
25210240.1262560.505642.020324.039816.1561129.249
25310240.1262560.503642.012324.023816.0931128.740
25410240.1252560.501642.004324.007816.0291128.235
25510240.1252560.499641.996323.992815.9671127.734
w3cw3c
automatyka przemysłowa