このページは[[OS-Wikiのページ:http://community.osdev.info/index.php?%28PIT%298254]]のコピーです。
----
* PIT 8254のページ [#v1e4c5fd]
-PITは「Programmable Interval Timer」の略
-AT互換機に1個、TONWSには2個(ただし8253)、PC-9801には1個(ただし8253)
--8253にはリードバックコマンドがない(それ以外は同じ)
-AT互換機ではPITに1.19318MHzのクロックが与えられている。
-TOWNSではPITに307.2KHz(ch0-2)と1.2288MHz(ch4)のクロックが与えられている。
--さらに上位機種には1.00MHzのインターバルタイマ2がある(註:これは8254系ではない)
-PC-9801はPITに2.4576MHz(システムクロック5MHz系時)もしくは1.9968MHz(システムクロック8MHz系時)のクロックが与えられている。

* 関係するI/Oポート [#w972eddd]
*** AT互換機 [#aee47290]
-0x0040 (8bit, R/W):カウンタ0 (IRQ0用)
--DOSではモード2でカウント65536を設定
-0x0041 (8bit, R/W):カウンタ1 (メインメモリ・リフレッシュ用)
--通常はモード2でカウント0x18を設定 --- メモリやチップセットやBIOSによっては違う
-0x0042 (8bit, R/W):カウンタ2 (BEEP用)
--通常はモード3 --- モード2でも多分音は出るけど、音色は変わるでしょう(このカウンタをモード3以外に設定することがハード的に可能なのかも分かりませんが)
-0x0043 (8bit, W):コントールレジスタ
-0x0061 (8bit, R):システムポート
--bit0:カウンタ2のGATEピンの状態
--bit1:スピーカイネーブルピンの状態
---これとカウンタ2のOUT値のANDがスピーカに接続されている
--bit2:ライト時のbit2の値が読める
--bit3:ライト時のbit3の値が読める
--bit4:(メモリリフレッシュが行われるたびに値が反転)
--bit5:カウンタ2のOUTピンの状態
--bit6:(ISAのIOCHK信号がアサートされてNMIが発生すると1になる)
--bit7:(メモリパリティエラーが発生すると1になる)
-0x0061 (8bit, W):システムポート
--bit0:カウンタ2のGATEピンへの出力値
--bit1:スピーカイネーブルピンへの出力値(1でBEEP-ON)
--bit2:(1にすると、メモリパリティエラーを検出したときにNMIが発生)
--bit3:(1にすると、ISAのIOCHK信号でNMIが発生)
--bit4-7:リザーブ(0にするのを推奨)

*** TOWNS [#d7545fb5]
-上位機種は合計で8カウンタをもち、そのうちの3つがIRQ0の発生要因として使用可能
--この他にもFM音源部にタイマ割り込みがある
--とくに1.00MHzのインターバルタイマ2とフリーランタイマレジスタは非常に有用である(8254系ではないので使いやすい)
--IRQがレベルトリガになっていることも含めて、ここまでタイマ周りが優秀なハードウェアは他にはないと思われる

-0x0040 (8bit, R/W):カウンタ0 (IRQ0用 - インターバルタイマ用)
--通常はモード3で使用
-0x0042 (8bit, R/W):カウンタ1 (IRQ0用 - I/O制御用)
--通常はモード0で使用
-0x0044 (8bit, R/W):カウンタ2 (BEEP用)
--通常はモード3 --- モード2でも多分音は出るけど、音色は変わるでしょう(このカウンタをモード3以外に設定することがハード的に可能なのかも分かりませんが)
-0x0046 (8bit, W):コントールレジスタ(ch0-2用)
-0x0050 (8bit, R/W):カウンタ3 (リザーブ)
-0x0052 (8bit, R/W):カウンタ4 (RS-232Cのボーレート用)
--通常はモード3で使用
-0x0054 (8bit, R/W):カウンタ5 (リザーブ)
-0x0056 (8bit, W):コントールレジスタ(ch3-5用)
-0x0060 (8bit, W):割込み制御レジスタ
--bit0:ch0のタイムアウト割り込み許可(0でマスク、1で許可)
--bit1:ch1のタイムアウト割り込み許可(0でマスク、1で許可)
--bit2:BEEP出力制御(1でBEEP-ON)
--bit3-6:リザーブ(0で書き込むことを強く推奨)
--bit7:1でch0のタイムアウトフラグをクリア
---0に戻す必要はない。書き込み時に1だと、そのときにタイムアウトフラグクリア動作が行われる、ということにすぎない。0だとその動作が起きないだけ。
---TOWNSの割り込みは全てレベルトリガであり、この動作でタイムアウトフラグを下げないと、IRQ0がかかりっぱなしになる(もちろん、ch0の割り込みそのものが不要なら、bit0を0にすればよい)。
---なお、ch1にはタイムアウトフラグを下げるためのコマンドビットはない。新しいカウントを書き込むと、自動的にタイムアウトフラグが下がる。これはch1は非周期的な割り込みを扱うために用意されたものであって、毎回カウンタの書き換えが必要だろうという設計思想に基づいている(すばらしい)。カウンタを書き換える際には、カウンタだけではなく、コマンドレジスタ、カウンタ、(カウンタ)、の順にアクセスすることをおすすめする。
-0x0060 (8bit, R):割込み要因レジスタ
--bit0:ch0のタイムアウトフラグ(1でタイムアウトしたことを示す、0はカウント中)
--bit1:ch1のタイムアウトフラグ(1でタイムアウトしたことを示す、0はカウント中)
--bit2:ch0のタイムアウト割り込み許可、の設定値が読める
--bit3:ch1のタイムアウト割り込み許可、の設定値が読める
--bit4:BEEP出力制御、の設定値が読める
-0x0026 (16bit, R):フリーランタイマレジスタ
--bit0-15:カウント値
---これは1マイクロ秒ごとに1ずつカウントアップされるレジスタで、たとえばある処理を挟んで2回読みとって差を求めることで、65ms以内の経過時間を測定するなどができる。非常に有用であるが、HG、HR、UG以降でしか利用できない。
-0x0068 (8bit, W):インターバルタイマ2制御レジスタ
--このレジスタは非常に有用であるが10F以降でしか利用できない
--bit0-6:リザーブ(0で書き込むことを強く推奨)
--bit7:インターバルタイマ2のタイムアウト割り込みマスク(0で許可、1でマスク)
-0x0068 (8bit, R):インターバルタイマ2制御レジスタ
--このレジスタは非常に有用であるが10F以降でしか利用できない
--bit0-4:リザーブ
--bit5:タイムアウトフラグが0になっていないときにさらにタイムアウトすると1になる(オーバフラグ)
--bit6:タイムアウトフラグ(1でタイムアウトあり)
--bit7:インターバルタイマ2のタイムアウト割り込みマスク、の設定値が読める
--このレジスタをリードすると、リード直後にタイムアウトフラグとオーバフラグは0クリアされる
-0x006a (16bit, R/W):インターバルタイマ2周期レジスタ
--bit0-15:割り込み周期設定値(マイクロ秒単位で設定)
---このレジスタは非常に有用であるが10F以降でしか利用できない
-0x006c (8bit, W):1マイクロ秒WAITレジスタ
--このレジスタは非常に有用であるが10F以降でしか利用できない
--bit0-7:リザーブ(0で書き込むことを強く推奨)
--このレジスタへの書き込み動作で、1マイクロ秒のwaitがかかる
-0x006c (8bit, R):1マイクロ秒WAITレジスタ
--このレジスタは非常に有用であるが10F以降でしか利用できない
--bit0-6:リザーブ
--bit7:常に0(ここが1だと10Fより前のモデルであることを意味する)

*** PC-9801 [#vaa707c3]
-0x0071 (8bit, R/W):カウンタ0 (IRQ0用)
--モード3で使用。
-0x0073 (8bit, R/W):カウンタ1 (メインメモリ・リフレッシュ用の機種と、BEEP用の機種とがある)
--モード3で使用。
-0x0075 (8bit, R/W):カウンタ2 (BEEP用)
--モード3で使用。
-0x0077 (8bit, W):コントールレジスタ
-0x3fdb (8bit, R/W):カウンタ1 (多くの機種のノーマルモードでは、こちらでないとアクセスできない。BEEP用)
--モード3で使用。
-0x3fdf (8bit, W):コントールレジスタ
--ここにライトすることと0x0077にライトすることは全く同じ

* 8254の基礎 [#x9a6f731]
-8524は内部に16bitのカウンタを3つ持っている。それぞれに外部からクロックが与えられ(でもたいていは同一クロックを与えているようだけど)、またそれぞれを別々のモードで駆動させることができる。
-カウントは原則としてデクリメントであり、周期的なモードではカウントが0になった瞬間に設定値が再ロードされる(つまり、カウント値0という値は読み出せない)。
-ハードウェア的には、以下の3つの信号ピンが関係している(これらはカウンタの個数だけある)。
--CLK:クロック(カウンタをデクリメントするためのクロック)
--GATE:ゲート(カウンタを始動させたり一時停止させたり再開させたりするためのピン)
--OUT:アウト(カウント値によって制御されるPITの出力ピン、これがIRQのトリガになったりBEEP出力になったりしている)
-カウントは、2進数カウントモードと、BCDカウントモードがある。純粋な8254にはBCDモードがあるが、PCのチップセットに集積されたものについては、BCDモードが省略されている可能性があるのでお勧めできない。
-8254は、現在のカウント値をラッチによって読み取ることができるが、設定値を読取る方法はない。設定値を知りたければ、カウンタを何度もリードして監視して、最大値を取得するしかない。
--リードバックコマンドを使って、少ないサンプリング数で正確な設定値を推測するテクニックもある。

-コントロールレジスタの各ビットの意味は次の通り。
--bit0:カウントモード
---0:2進数カウント
---1:BCDカウント
--bit1-3:カウントモード
---000:モード0(ターミナルカウント)
---001:モード1(プログラマブルワンショット)
---x10:モード2(レートジェネレータ)
---x11:モード3(方形波レートジェネレータ)
---100:モード4(ソフトウェアトリガストローブ)
---101:モード5(ハードウェアトリガストローブ)
--bit4-5:カウンタアクセスモード
---11:16bitリードロード(下位8bit、上位8bitの順)
---10:上位8bitのリードロード
---01:下位8bitのリードロード
---00:カウント値ラッチ
--bit6-7:カウンタチャンネル指定
---00:カウンタ0
---01:カウンタ1
---10:カウンタ2
---11:リードバックコマンド(後述)

-カウント値を設定するには、一般に以下の手順で行なう。
--コントールレジスタに設定したいチャンネルのモードを設定。直前と同じモードであっても、これを設定しないとうまく動作しないことがある。
--そして、目的のカウンタに値をセット。8bitモードなら1回のアクセスになるし、16ビットモードなら、下位8bit、上位8bitの順に書き込む。
--モード設定から、カウント値の設定完了までの間に、他のチャンネルのモード設定をしたり他のチャンネルのカウンタへ読み書きすると、設定も挙動も不定となる。

-カウント値を読み取るには、一般に次の手順で行なう。
--コントールレジスタを使って、読み取りたいチャンネルに対してラッチを実施。
--読み取りのカウンタアクセスモードは、書き込み時のモードと同じになる。

*** ものぐさなひとのために [#j1e80bb6]
-ぶちゃっけ、読者の多くはAT互換機でタイマーとBEEPの設定をすると思うので、そこだけをぱぱっと説明。
-IRQ0の割り込み周期変更:
--AL = 0x34; OUT(0x43, AL);
--AL = 割り込み周期の下位8bit; OUT(0x40, AL);
--AL = 割り込み周期の上位8bit; OUT(0x40, AL);
--これでおしまい。
--割り込み周期に0を指定すると65536を指定したとみなされる。実際の割り込み頻度は、クロック/設定カウント値。つまり、1000を指定すれば、1.19318KHz。10000なら119.318Hz、といった具合。例えば11932を設定すれば、約100Hzになって、10msごとに割り込むようになるわけだ。
-BEEP音の制御:
--音程操作:
---AL = 0xb6; OUT(0x43, AL);
---AL = 設定値の下位8bit; OUT(0x42, AL);
---AL = 設定値の上位8bit; OUT(0x42, AL);
---設定値0は、65536として扱われる。
---これで発振される音程は、クロック/設定カウント値。つまり、1000を指定すれば、1.19318KHz。10000なら119.318Hz、といった具合。例えば2712を設定すれば、約440Hzになる。
--BEEPのON/OFF:
---これはI/Oポート0x61を使う。
---ON: IN(AL, 0x61); AL |= 0x03; AL &= 0x0f; OUT(0x61, AL);
---OFF: IN(AL, 0x61); AL &= 0xd; OUT(0x61, AL);

* 6つのモード [#h72f8c4e]




* こめんと欄 [#t393a94b]
-ここにKさんが書いてくださった内容を参考にして''Mona''のpic.cpp内のタイマの設定はかかれる予定です。 -- ''''ひげぽん'''' SIZE(10){2004-01-09 (金) 21:55:07}
-少しは役に立ったようでうれしいです。 -- ''K'' SIZE(10){2004-01-10 (土) 00:16:17}
 void setTimerInterval(dword ms) {
     dword timerCounter = ms * 1193.18;
     outportb(0x43, 0x34);
     outportb(0x40, timerCounter & 0xff);
     outportb(0x40, timerCounter >> 8);
 }
-タイマ割込み周期設定関数を作ってみました。引数はmsです。 -- ''''ひげぽん'''' SIZE(10){2004-01-11 (日) 03:51:43}
-''Mona''で上記の関数をテストしましたがきちんと動いているようです。 -- ''''ひげぽん'''' SIZE(10){2004-01-11 (日) 17:26:52}
-実機でテストしたところカーネルが起動中に止まってしまったので現在調査中です。 -- ''''ひげぽん'''' SIZE(10){2004-01-11 (日) 21:05:49}
-loXIUGaA -- ''wQjfKSDbCLHFKXsWCWb'' SIZE(10){2008/07/28 (月) 00:44:16}

#comment

//*  The page of PIT 8254 as for -PIT abbreviation of the " Programmable Interval Timer " -AT in the compatible machine 1, in the TONWS 2  (however 8253), in the PC-9801 1 (however 8253) there is no lead/read  back command in --8253, (the other than that is same) -AT in the  compatible machine the clock of the 1.19318mHz is given to the PIT.   With -TOWNS the 307.2kHz (ch0-2) with the 1.2288mHz (the ch4) the  clock is given to the PIT.  -- furthermore there is an interval timer  2 of the 1.00MHz in the superior type, (note:  As for this 8254  systems is not) the -PC-9801 the 2.4576mHz (at the time of system  clock 5mHz system) or the 1.9968mHz (at the time of system clock 8mHz  system) the clock is given to the PIT.  *  The I/O port *** AT  compatible machine which is related -0x0040 (the 8bit and the R/W):   Counter 0 (for IRQ0) with --DOS with mode 2 count 65536 setting  -0x0041 (8bit and R/W):  The counter 1 (the for main memory refresh)  -- usually with mode 2 the count 0x18 setting --- depending upon  memory and tip/chip set and the BIOS -0x0042 where it is different  (the 8bit and the R/W):  The counter 2 (the for BEEP) -- usually mode  3 --- perhaps as for sound however it comes out, as for the timbre it  changes even with mode 2, probably will be, you do not understand but) -0x0043 (the 8bit and W) whether (hard it is possible to set this  counter other than mode 3,:  Short story - Lu register -0x0061 (8bit  and R):  System port --bit0:  State --bit1 of GATE pin of counter 2:   State of the speaker enabling pin --- this and the --bit2 where the  AND of OUT value of counter 2 is connected to the speaker:  The --bit3 which can read the value of the bit2 at the time of the light/write:   The --bit4 which can read the value of the bit3 at the time of the  light/write:  (The memory refreshment is done at each time value  reversal) the --bit5:  State --bit6 of OUT pin of counter 2:  (The  IOCHK signal of the ISA being asserted, when the NMI occurs, it  becomes in 1) the --bit7:  When (memory parity error occurs, it  becomes in 1) -0x0061 (the 8bit and W):  System port --bit0:  Output  value --bit1 to GATE pin of counter 2:  Output value to speaker  enabling pin (at 1 BEEP-ON) --bit2:  When (it makes 1, when detecting  memory parity error, the NMI occurrence) the --bit3:  When (it makes  1, with the IOCHK signal of the ISA the NMI occurrence) the --bit4-7:   Reservation (making 0 recommendation) the *** TOWNS - as for the  superior type -- where to active -- these in addition to there is the  timer interruption in the FM sound source 8 counters with, as an  occurrence primary factor of 3 Tsuga IRQ0 the among those as for  interval timer 2 of the especially 1.00MHz and the free run timer  register it is very useful at total, (being not to be 8254 systems, it is easy to use) including also the fact that the --IRQ becomes the  level trigger, to here as for the hardware whose surroundings of the  timer are excellent -0x0040 where it is thought there are no other  things, (the 8bit and the R/W):  Counter 0 (for IRQ0  -      The for interval timer) -- usually with mode 3 use -0x0042 (the 8bit and  the R/W):  Counter 1 (for IRQ0  -      For I/O control) --  usually with mode 0 use -0x0044 (the 8bit and the R/W):  The counter 2 (the for BEEP) -- usually mode 3 --- perhaps as for sound however it  comes out, as for the timbre it changes even with mode 2, probably  will be, you do not understand but) -0x0046 (the 8bit and W) whether  (hard it is possible to set this counter other than mode 3,:  Short  story - Lu register (for ch0-2) -0x0050 (8bit and R/W):  Counter 3  (reservation) -0x0052 (8bit and R/W):  The counter 4 (the for baud  rate of the RS-23C2c) -- usually with mode 3 use -0x0054 (the 8bit and the R/W):  Counter 5 (reservation) -0x0056 (8bit and W):  Short story  - Lu register (for ch3-5) -0x0060 (8bit and W):  Interrupt control  register --bit0:  Timeout interruption permission of ch0 (with 0 mask, at 1 permission) --bit1:  Timeout interruption permission of ch1 (with 0 mask, at 1 permission) --bit2:  Power control BEEP (at 1 BEEP-ON)  --bit3-6:  Reservation (writing with 0 it is strong recommendation)  the --bit7:  It is not necessary the timeout flag of the ch0 to reset  in clearing ---0 at 1.  When writing in when 1 is, it is no more than  a notion that where timeout flag clearing operation is done that time. When 0 is, the operation just does not occur.  Unless the interruption of the ---TOWNS is all level triggers, the timeout flag is lowered  with this operation, the IRQ0 becomes keeps catching, if (of course,  the interruption very thing of the ch0 unnecessary, the bit0 should  have been designated as 0).  Furthermore ---, there is no command bit  in order to lower the timeout flag in the ch1.  When new count is  written, the timeout flag goes down automatically.  As for this as for the ch1 being something which is prepared in order to handle the  aperiodic interruption, it has been based on the design philosophy  that each time rewriting the counter probably is necessary, (it is  splendid).  The case where the counter is rewritten, not only the  counter, the command register, the counter, (the counter), the male be completed it does that it accesses order.  -0x0060 (8bit and R):   Interruption primary factor register --bit0:  The timeout flag of the  ch0 (timeout the fact that it does is shown at 1, as for 0 while  counting) the --bit1:  The timeout flag of the ch1 (timeout the fact  that it does is shown at 1, as for 0 while counting) the --bit2:   Timeout interruption permission of the ch0, the --bit3 which can read  command:  Timeout interruption permission of the ch1, the --bit4 which can read command:  Power control BEEP, -0x0026 where you can read  command (the 16bit and R):  Free run timer register --bit0-15:  Count  value --- this with the register which it is counted 1 at a time is  raised, for example putting a certain processing in every microsecond, 2 times grasping, e.g., by the fact that it seeks difference, it  measures the elapsed time within the 65ms, is possible.  It is very  useful, but it can utilize only the after the Hg, the HR and the UG.   -0x0068 (8bit and W):  The interval timer 2 control register -- this  register is very useful, but only after the 10F the --bit0-6 which  cannot be utilized:  Reservation (writing with 0 it is strong  recommendation) the --bit7:  The timeout interruption mask of interval timer 2 (to permit with 0, at 1 the mask) -0x0068 (the 8bit and R):   The interval timer 2 control register -- this register is very useful, but only after the 10F the --bit0-4 which cannot be utilized:   Reservation --bit5:  When the timeout flag does not become 0, when  furthermore timeout it does, it becomes 1, (the over flag) the --bit6: The timeout flag (timeout it is at 1) the --bit7:  The timeout  interruption mask of interval timer 2, when -- where you can read  command this register is lead/read, immediately after the  leading/reading as for the timeout flag and the over flag 0 -0x006a  where it is cleared (the 16bit and the R/W):  Interval timer 2  periodic register --bit0-15:  Interruption periodic command (setting)  --- this register is very useful at the microsecond unit, but only  after the 10F -0x006c where it cannot utilize (the 8bit and W):  1  microsecond WAIT register -- this register is very useful, but only  after the 10F the --bit0-7 which cannot be utilized:  Reservation  (writing with 0 -0x006c where recommendation) -- with entry operation  on this register, the wait of 1 microsecond depends strongly (the 8bit and R):  1 microsecond WAIT register -- this register is very useful,  but only after the 10F the --bit0-6 which cannot be utilized:   Reservation --bit7:  When 0 (here 1 is always, the fact that it is the model before is meant from the 10F) *** PC-9801 -0x0071 (the 8bit and  the R/W):  The counter 0 (the for IRQ0) -- you use with mode 3.   -0x0073 (8bit and R/W):  The counter 1 (the type for main memory  refresh and the type for BEEP are) -- use with mode 3.  -0x0075 (8bit  and R/W):  The counter 2 (the for BEEP) -- you use with mode 3.   -0x0077 (8bit and W):  Short story - Lu register -0x3fdb (8bit and  R/W):  The counter 1 (unless this way it is, it cannot access with the normal mode of many types.  The for BEEP) -- you use with mode 3.   -0x3fdf (8bit and W):  The short story - the Lu register -- here  especially and the 0x0077 which the light/write are done as for the  light/write doing completely the same * the foundation of 8254 as for  -8524 3 it has the counter of the 16bit inside.  Respectively, it can  give the clock from outside and (with mostly, as given the identical  clock, but, it is possible in addition to drive each one with separate mode.  - Count as a general rule is decrement, with periodic mode  command is reloaded instantaneously count has become 0 (to be plugged  every single count value 0 value cannot read out).  - Hardware, three  signal pins below are related, (as for these there is just a quantity  of the counter).  --CLK:  The clock (the clock in order decrement to  do the counter) the --GATE:  The pin in order the gate (you make the  counter start and/or make stop and/or at one time to reopen) the  --OUT:  The output pin of the PIT which is controlled out (by count  value, the り which has become the り cBeep output where this had  become the trigger of the IRQ has done) - count, is a binary count  mode and a BCD count mode.  There is a BCD mode in pure 8254 being to  be a possibility BCD mode being abbreviated, but concerning those  which were accumulated to the tip/chip set of the PC, we cannot  recommend.  As for -8254, it can grasp present count value with latch, but there is no method of grasping command.  We probably would like to know command, the counter leading/reading many degrees, watching,  there is no other choice but to acquire maximum value.  -- using  lead/read back command, there is also a technique which at the little  presumes accurate command number of samplings.  - Meaning of each bit  is of control register as follows.  --bit0:  Count mode ---0:  Binary  count ---1:  BCD count --bit1-3:  Count mode ---000:  Mode 0 (terminal count) ---001:  Mode 1 (programmable one shot) ---x10:  Mode 2 (rate  generator) ---x11:  Mode 3 (square wave rate generator) ---100:  Mode  4 (software trigger strobe) ---101:  Mode 5 (hardware trigger strobe)  --bit4-5:  Counter access mode ---11:  16bit lead/read load (order of  subordinate 8bit and superior 8bit) ---10:  Lead/read load of superior 8bit ---01:  Lead/read load of subordinate 8bit ---00:  Count value  latch --bit6-7:  Counter channel appointment ---00:  Counter 0 ---01:   Counter 1 ---10:  Counter 2 ---11:  Lead/read back command (later  description) - count value is set, it does generally with procedure  below.  -- the short story - it sets the mode of the channel which  would like to set to the Lu register.  Being the same mode as  immediately before, it does not set this you question, there are times which it sows and does not operate.  You set value to -- and the  intended counter.  If 8bit mode it becomes the access of 1 time if  and, 16 bit mode, you write to the order of the subordinate 8bit and  the superior 8bit.  When -- from mode setting, during to completion of setting of count value, it does the mode setting of the other channel  and/or reads and writes to the counter of the other channel, setting  and behavior become uncertainty.  - To grasp count value, it does  generally with the following procedure.  -- the short story - using  the Lu register, it executes latch vis-a-vis the channel which we  would like to grasp.  -- counter access mode of reading becomes same  as the mode when writing in.  The *** thing ぐ because - the spotted  ゃ っ け, you think many of the reader because of one, it sets the  timer and the BEEP with the AT compatible machine, just there the ぱ  suddenly explanation.  -IRQ0 interruption periodic modification:  --AL = 0x34;  OUT (0x43, AL);  --AL = it interrupts, the subordinate 8bit  of period;  OUT (0x40, AL);  --AL = it interrupts, the superior 8bit  of period;  OUT (0x40, AL);  -- with this end.  When -- 0 is appointed to interruption period, it is regarded 65536 was appointed.  As for  actually interruption frequency, clock / setting count value.  In  other words, if it appoints 1000, the 1.19318kHz.  If 10000 the  119.318hz, with the condition which was said.  For example if 11932 is set, becoming approximately 100Hz, it is the case that it reaches the  point where it interrupts every 10ms.  -BEEP control of sound:  --  musical interval operation:  ---AL = 0xb6;  OUT (0x43, AL);   Subordinate 8bit of ---AL = command;  OUT (0x42, AL);  Superior 8bit  of ---AL = command;  OUT (0x42, AL);  --- command 0 is handled as  65536.  --- as for the musical interval which oscillates with this,  clock / setting count value.  In other words, if it appoints 1000, the 1.19318kHz.  If 10000 the 119.318hz, with the condition which was  said.  For example if 2712 is set, it becomes approximately 440Hz.   The ON/OFF of --BEEP:  --- this uses the I/O port 0x61.  ---ON:  IN  (AL and 0x61);  AL |= 0x03;  AL &= 0x0f;  OUT (0x61, AL);  ---OFF:  IN (AL and 0x61);  AL &= 0xd;  OUT (0x61, AL);  *  Six modes * it is to  include with the column - with the contents the K writing here as a  reference [ [ as for setting of the timer inside the pic.cpp of the  Mona ] ] it is the schedule which can be caught.  -- [ [ [ [ the  self-depreciation ぽ it is ] ] ] ] the SIZE (10) { 2004-01-09 (the  gold) 21:55:07 } - a little as is useful, it is delightful, is.  -- [  [ K ] ] SIZE (10) { 2004-01-10 (Saturday) 00:16:17 } void  setTimerInterval (dword ms) { dword timerCounter = ms * 1193.18;   Outportb (0x43, 0x34);  Outportb (0x40, timerCounter & 0xff);   Outportb (0x40, timerCounter >> 8);  } - You tried making timer  interruption periodic setting function.  Argument is the ms.  -- [ [ [ [ the self-depreciation ぽ is ] ] ] ] the SIZE (10) { 2004-01-11  (day) 03:51:43 } - [ [ above-mentioned function was tested with the  Mona ] ], but it seems that is moving securely.  -- [ [ [ [ the  self-depreciation ぽ it is ] ] ] ] the SIZE (10) { 2004-01-11 (day)  17:26:52 } - when it tests with the apparatus it meaning that the  kernel stops while starting, presently it is in the midst of  investigating.  -- [ [ [ [ the self-depreciation ぽ it is ] ] ] ] the SIZE (10) { 2004-01-11 (day) 21:05:49 } #comment



[リロード]   [トップ] [一覧] [単語検索] [最終更新]   [最終更新のRSS]