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: 11059200 Hz
OCR2  Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. Prescaler Freq. 
010241080025643200641728003234560081382400111059200
11024540025621600648640032172800869120015529600
21024360025614400645760032115200846080013686400
3102427002561080064432003286400834560012764800
410242160256864064345603269120827648012211840
510241800256720064288003257600823040011843200
610241542.8572566171.4296424685.7143249371.4298197485.71411579885.714
710241350256540064216003243200817280011382400
810241200256480064192003238400815360011228800
910241080256432064172803234560813824011105920
101024981.8182563927.2736415709.0913231418.1828125672.72711005381.818
11102490025636006414400322880081152001921600
121024830.7692563323.0776413292.3083226584.6158106338.4621850707.692
131024771.4292563085.7146412342.8573224685.714898742.8571789942.857
1410247202562880641152032230408921601737280
1510246752562700641080032216008864001691200
161024635.2942562541.1766410164.7063220329.412881317.6471650541.176
171024600256240064960032192008768001614400
181024568.4212562273.684649094.7373218189.474872757.8951582063.158
191024540256216064864032172808691201552960
201024514.2862562057.143648228.5713216457.143865828.5711526628.571
211024490.9092561963.636647854.5453215709.091862836.3641502690.909
221024469.5652561878.261647513.0433215026.087860104.3481480834.783
231024450256180064720032144008576001460800
241024432256172864691232138248552961442368
251024415.3852561661.538646646.1543213292.308853169.2311425353.846
261024400256160064640032128008512001409600
271024385.7142561542.857646171.4293212342.857849371.4291394971.429
281024372.4142561489.655645958.6213211917.241847668.9661381351.724
291024360256144064576032115208460801368640
301024348.3872561393.548645574.1943211148.387844593.5481356748.387
311024337.500256135064540032108008432001345600
321024327.2732561309.091645236.3643210472.727841890.9091335127.273
331024317.6472561270.588645082.3533210164.706840658.8241325270.588
341024308.5712561234.286644937.143329874.286839497.1431315977.143
35102430025612006448003296008384001307200
361024291.8922561167.568644670.270329340.541837362.1621298897.297
371024284.2112561136.842644547.368329094.737836378.9471291031.579
381024276.9232561107.692644430.769328861.538835446.1541283569.231
39102427025610806443203286408345601276480
401024263.4152561053.659644214.634328429.268833717.0731269736.585
411024257.1432561028.571644114.286328228.571832914.2861263314.286
421024251.1632561004.651644018.605328037.209832148.8371257190.698
431024245.455256981.818643927.273327854.545831418.1821251345.455
4410242402569606438403276808307201245760
451024234.783256939.130643756.522327513.043830052.1741240417.391
461024229.787256919.149643676.596327353.191829412.7661235302.128
4710242252569006436003272008288001230400
481024220.408256881.633643526.531327053.061828212.2451225697.959
4910242162568646434563269128276481221184
501024211.765256847.059643388.235326776.471827105.8821216847.059
511024207.692256830.769643323.077326646.154826584.6151212676.923
521024203.774256815.094643260.377326520.755826083.0191208664.151
5310242002568006432003264008256001204800
541024196.364256785.455643141.818326283.636825134.5451201076.364
551024192.857256771.429643085.714326171.429824685.7141197485.714
561024189.474256757.895643031.579326063.158824252.6321194021.053
571024186.207256744.828642979.310325958.621823834.4831190675.862
581024183.051256732.203642928.814325857.627823430.5081187444.068
5910241802567206428803257608230401184320
601024177.049256708.197642832.787325665.574822662.2951181298.361
611024174.194256696.774642787.097325574.194822296.7741178374.194
621024171.429256685.714642742.857325485.714821942.8571175542.857
631024168.7502566756427003254008216001172800
641024166.154256664.615642658.462325316.923821267.6921170141.538
651024163.636256654.545642618.182325236.364820945.4551167563.636
661024161.194256644.776642579.104325158.209820632.8361165062.687
671024158.824256635.294642541.176325082.353820329.4121162635.294
681024156.522256626.087642504.348325008.696820034.7831160278.261
691024154.286256617.143642468.571324937.143819748.5711157988.571
701024152.113256608.451642433.803324867.606819470.4231155763.380
7110241502566006424003248008192001153600
721024147.945256591.781642367.123324734.247818936.9861151495.890
731024145.946256583.784642335.135324670.270818681.0811149448.649
7410241442565766423043246088184321147456
751024142.105256568.421642273.684324547.368818189.4741145515.789
761024140.260256561.039642244.156324488.312817953.2471143625.974
771024138.462256553.846642215.385324430.769817723.0771141784.615
781024136.709256546.835642187.342324374.684817498.7341139989.873
7910241352565406421603243208172801138240
801024133.333256533.333642133.333324266.667817066.6671136533.333
811024131.707256526.829642107.317324214.634816858.5371134868.293
821024130.120256520.482642081.928324163.855816655.4221133243.373
831024128.571256514.286642057.143324114.286816457.1431131657.143
841024127.059256508.235642032.941324065.882816263.5291130108.235
851024125.581256502.326642009.302324018.605816074.4191128595.349
861024124.138256496.552641986.207323972.414815889.6551127117.241
871024122.727256490.909641963.636323927.273815709.0911125672.727
881024121.348256485.393641941.573323883.146815532.5841124260.674
8910241202564806419203238408153601122880
901024118.681256474.725641898.901323797.802815191.2091121529.670
911024117.391256469.565641878.261323756.522815026.0871120208.696
921024116.129256464.516641858.065323716.129814864.5161118916.129
931024114.894256459.574641838.298323676.596814706.3831117651.064
941024113.684256454.737641818.947323637.895814551.5791116412.632
951024112.5002564506418003236008144001115200
961024111.340256445.361641781.443323562.887814251.5461114012.371
971024110.204256440.816641763.265323526.531814106.1221112848.980
981024109.091256436.364641745.455323490.909813963.6361111709.091
9910241082564326417283234568138241110592
1001024106.931256427.723641710.891323421.782813687.1291109497.030
1011024105.882256423.529641694.118323388.235813552.9411108423.529
1021024104.854256419.417641677.670323355.340813421.3591107370.874
1031024103.846256415.385641661.538323323.077813292.3081106338.462
1041024102.857256411.429641645.714323291.429813165.7141105325.714
1051024101.887256407.547641630.189323260.377813041.5091104332.075
1061024100.935256403.738641614.953323229.907812919.6261103357.009
10710241002564006416003232008128001102400
108102499.083256396.330641585.321323170.642812682.5691101460.550
109102498.182256392.727641570.909323141.818812567.2731100538.182
110102497.297256389.189641556.757323113.514812454.054199632.432
111102496.429256385.714641542.857323085.714812342.857198742.857
112102495.575256382.301641529.204323058.407812233.628197869.027
113102494.737256378.947641515.789323031.579812126.316197010.526
114102493.913256375.652641502.609323005.217812020.870196166.957
115102493.103256372.414641489.655322979.310811917.241195337.931
116102492.308256369.231641476.923322953.846811815.385194523.077
117102491.525256366.102641464.407322928.814811715.254193722.034
118102490.756256363.025641452.101322904.202811616.807192934.454
119102490256360641440322880811520192160
120102489.256256357.025641428.099322856.198811424.793191398.347
121102488.525256354.098641416.393322832.787811331.148190649.180
122102487.805256351.220641404.878322809.756811239.024189912.195
123102487.097256348.387641393.548322787.097811148.387189187.097
124102486.400256345.600641382.400322764.800811059.200188473.600
125102485.714256342.857641371.429322742.857810971.429187771.429
126102485.039256340.157641360.630322721.260810885.039187080.315
127102484.375256337.500641350322700810800186400
128102483.721256334.884641339.535322679.070810716.279185730.233
129102483.077256332.308641329.231322658.462810633.846185070.769
130102482.443256329.771641319.084322638.168810552.672184421.374
131102481.818256327.273641309.091322618.182810472.727183781.818
132102481.203256324.812641299.248322598.496810393.985183151.880
133102480.597256322.388641289.552322579.104810316.418182531.343
134102480256320641280322560810240181920
135102479.412256317.647641270.588322541.176810164.706181317.647
136102478.832256315.328641261.314322522.628810090.511180724.088
137102478.261256313.043641252.174322504.348810017.391180139.130
138102477.698256310.791641243.165322486.33189945.324179562.590
139102477.143256308.571641234.286322468.57189874.286178994.286
140102476.596256306.383641225.532322451.06489804.255178434.043
141102476.056256304.225641216.901322433.80389735.211177881.690
142102475.524256302.098641208.392322416.78389667.133177337.063
14310247525630064120032240089600176800
144102474.483256297.931641191.724322383.44889533.793176270.345
145102473.973256295.890641183.562322367.12389468.493175747.945
146102473.469256293.878641175.510322351.02089404.082175232.653
147102472.973256291.892641167.568322335.13589340.541174724.324
148102472.483256289.933641159.732322319.46389277.852174222.819
14910247225628864115232230489216173728
150102471.523256286.093641144.371322288.74289154.967173239.735
151102471.053256284.211641136.842322273.68489094.737172757.895
152102470.588256282.353641129.412322258.82489035.294172282.353
153102470.130256280.519641122.078322244.15688976.623171812.987
154102469.677256278.710641114.839322229.67788918.710171349.677
155102469.231256276.923641107.692322215.38588861.538170892.308
156102468.790256275.159641100.637322201.27488805.096170440.764
157102468.354256273.418641093.671322187.34288749.367169994.937
158102467.925256271.698641086.792322173.58588694.340169554.717
159102467.50025627064108032216088640169120
160102467.081256268.323641073.292322146.58488586.335168690.683
161102466.667256266.667641066.667322133.33388533.333168266.667
162102466.258256265.031641060.123322120.24588480.982167847.853
163102465.854256263.415641053.659322107.31788429.268167434.146
164102465.455256261.818641047.273322094.54588378.182167025.455
165102465.060256260.241641040.964322081.92888327.711166621.687
166102464.671256258.683641034.731322069.46188277.844166222.754
167102464.286256257.143641028.571322057.14388228.571165828.571
168102463.905256255.621641022.485322044.97088179.882165439.053
169102463.529256254.118641016.471322032.94188131.765165054.118
170102463.158256252.632641010.526322021.05388084.211164673.684
171102462.791256251.163641004.651322009.30288037.209164297.674
172102462.428256249.71164998.844321997.68887990.751163926.012
173102462.069256248.27664993.103321986.20787944.828163558.621
174102461.714256246.85764987.429321974.85787899.429163195.429
175102461.364256245.45564981.818321963.63687854.545162836.364
176102461.017256244.06864976.271321952.54287810.169162481.356
177102460.674256242.69764970.787321941.57387766.292162130.337
178102460.335256241.34164965.363321930.72687722.905161783.240
1791024602562406496032192087680161440
180102459.669256238.67464954.696321909.39287637.569161100.552
181102459.341256237.36364949.451321898.90187595.604160764.835
182102459.016256236.06664944.262321888.52587554.098160432.787
183102458.696256234.78364939.130321878.26187513.043160104.348
184102458.378256233.51464934.054321868.10887472.432159779.459
185102458.065256232.25864929.032321858.06587432.258159458.065
186102457.754256231.01664924.064321848.12887392.513159140.107
187102457.447256229.78764919.149321838.29887353.191158825.532
188102457.143256228.57164914.286321828.57187314.286158514.286
189102456.842256227.36864909.474321818.94787275.789158206.316
190102456.545256226.17864904.712321809.42487237.696157901.571
191102456.2502562256490032180087200157600
192102455.959256223.83464895.337321790.67487162.694157301.554
193102455.670256222.68064890.722321781.44387125.773157006.186
194102455.385256221.53864886.154321772.30887089.231156713.846
195102455.102256220.40864881.633321763.26587053.061156424.490
196102454.822256219.28964877.157321754.31587017.259156138.071
197102454.545256218.18264872.727321745.45586981.818155854.545
198102454.271256217.08564868.342321736.68386946.734155573.869
1991024542562166486432172886912155296
200102453.731256214.92564859.701321719.40386877.612155020.896
201102453.465256213.86164855.446321710.89186843.564154748.515
202102453.202256212.80864851.232321702.46386809.852154478.818
203102452.941256211.76564847.059321694.11886776.471154211.765
204102452.683256210.73264842.927321685.85486743.415153947.317
205102452.427256209.70964838.835321677.67086710.680153685.437
206102452.174256208.69664834.783321669.56586678.261153426.087
207102451.923256207.69264830.769321661.53886646.154153169.231
208102451.675256206.69964826.794321653.58986614.354152914.833
209102451.429256205.71464822.857321645.71486582.857152662.857
210102451.185256204.73964818.957321637.91586551.659152413.270
211102450.943256203.77464815.094321630.18986520.755152166.038
212102450.704256202.81764811.268321622.53586490.141151921.127
213102450.467256201.86964807.477321614.95386459.813151678.505
214102450.233256200.93064803.721321607.44286429.767151438.140
2151024502562006480032160086400151200
216102449.770256199.07864796.313321592.62786370.507150964.055
217102449.541256198.16564792.661321585.32186341.284150730.275
218102449.315256197.26064789.041321578.08286312.329150498.630
219102449.091256196.36464785.455321570.90986283.636150269.091
220102448.869256195.47564781.900321563.80186255.204150041.629
221102448.649256194.59564778.378321556.75786227.027149816.216
222102448.430256193.72264774.888321549.77686199.103149592.825
223102448.214256192.85764771.429321542.85786171.429149371.429
2241024482561926476832153686144149152
225102447.788256191.15064764.602321529.20486116.814148934.513
226102447.577256190.30864761.233321522.46786089.868148718.943
227102447.368256189.47464757.895321515.78986063.158148505.263
228102447.162256188.64664754.585321509.17086036.681148293.450
229102446.957256187.82664751.304321502.60986010.435148083.478
230102446.753256187.01364748.052321496.10485984.416147875.325
231102446.552256186.20764744.828321489.65585958.621147668.966
232102446.352256185.40864741.631321483.26285933.047147464.378
233102446.154256184.61564738.462321476.92385907.692147261.538
234102445.957256183.83064735.319321470.63885882.553147060.426
235102445.763256183.05164732.203321464.40785857.627146861.017
236102445.570256182.27864729.114321458.22885832.911146663.291
237102445.378256181.51364726.050321452.10185808.403146467.227
238102445.188256180.75364723.013321446.02585784.100146272.803
2391024452561806472032144085760146080
240102444.813256179.25364717.012321434.02585736.100145888.797
241102444.628256178.51264714.050321428.09985712.397145699.174
242102444.444256177.77864711.111321422.22285688.889145511.111
243102444.262256177.04964708.197321416.39385665.574145324.590
244102444.082256176.32764705.306321410.61285642.449145139.592
245102443.902256175.61064702.439321404.87885619.512144956.098
246102443.725256174.89964699.595321399.19085596.761144774.089
247102443.548256174.19464696.774321393.54885574.194144593.548
248102443.373256173.49464693.976321387.95285551.807144414.458
249102443.200256172.80064691.200321382.40085529.600144236.800
250102443.028256172.11264688.446321376.89285507.570144060.558
251102442.857256171.42964685.714321371.42985485.714143885.714
252102442.688256170.75164683.004321366.00885464.032143712.253
253102442.520256170.07964680.315321360.63085442.520143540.157
254102442.353256169.41264677.647321355.29485421.176143369.412
255102442.188256168.7506467532135085400143200
w3cw3c
automatyka przemysłowa