#freeze 閲覧総計:&counter(); (本日:&counter(today); 昨日:&counter(yesterday);) *トグルスイッチ [#w5775228] トグルスイッチ(toggle switch)とは、スイッチを押すたびにオン(ON)、オフ(OFF)の 状態が入れ替わる動作をするスイッチの事です。 トグルスイッチ機能を実現する為の定石プログラム記法がありますので紹介します。 07/02/11 |&attachref(P1010293.JPG,zoom,150x150,button){新しい写真添付};|&attachref(,zoom,150x150,button){新しい写真添付};| /** * トグル スイッチ * (スイッチを押すたびにON、OFFを切り替え) * * PIC16F628A 内蔵4MHz * LED: RB3 スイッチ: RB4 * 電源:乾電池3本(4.5V) * * Device Flags: _BODEN_OFF _BOREN_OFF _CP_OFF _PWRTE_ON _WDT_OFF * _LVP_OFF _MCLRE_OFF _INTRC_OSC_NOCLKOUT * MikroC 2.1 */ void main() { //使用変数の定義 unsigned short int oldstate; PORTB = 0b00000000; //PORTBの中身をきれいにする TRISB = 0b00010000; //RB4を1:入力、他は0:出力に設定 OPTION_REG.NOT_RBPU = 0; //PORTBを内部プルアップ //LED初期点灯状態の設定 PORTB.F3 = 1; //RB3 ON oldstate = 0; do { if(Button(&PORTB, 4, 1, 1)) oldstate = 1; if(oldstate && Button(&PORTB, 4, 1, 0)) { //RB4スイッチ状態の判別 PORTB.F3 = ~PORTB.F3; //RB3状態の反転 oldstate = 0; } }while(1); } ★この情報は役に立ちましたか? #vote(はい[3],いいえ[1]) - D7lv2l jr39ug7djalfgpitg94gbvm -- [[patrik]] &new{2008-05-22 (木) 20:22:55}; - It's funny goodluck <a href=" http://blogs.ign.com/ScottHostin/2008/05/11/89409/ "><b>cheap hotels orlando orange lake resort</b></a> 802936 -- [[Czbfrzfq]] &new{2008-05-24 (土) 17:19:53}; - Excellent work, Nice Design <a href=" http://groups.google.us/group/xxl-free-hot-sex-movies ">free live fucking on cam</a> cpc -- [[Obeqvjwh]] &new{2008-05-24 (土) 17:26:16}; - i'm fine good work <a href=" http://blogs.ign.com/ScottHostin/2008/05/11/89388/ "><b>chicago hotel last minute discount</b></a> >:( -- [[Ynwpnwiy]] &new{2008-05-24 (土) 19:34:38}; - i'm fine good work <a href=" http://blogs.ign.com/ScottHostin/2008/05/11/89388/ "><b>chicago hotel last minute discount</b></a> >:( -- [[Ynwpnwiy]] &new{2008-05-24 (土) 19:34:58}; - perfect design thanks <a href=" http://groups.google.us/group/u-free-hot-sex-movies ">fuck vans remix</a> dlyq -- [[Czbrrrzq]] &new{2008-05-24 (土) 19:43:25}; - this post is fantastic <a href=" http://groups.google.us/group/a-free-hot-sex-movies ">mothers who like to fuck</a> >:[[ -- [[Wacjwgul]] &new{2008-05-24 (土) 22:02:24}; - I love this site <a href=" http://blogs.ign.com/OsherKlarck "><b>cheap airline tickets to costa rica</b></a> 093947 -- [[Xzurawde]] &new{2008-05-25 (日) 00:07:38}; - It's serious <a href=" http://groups.google.us/group/z-free-hot-sex-movies ">pregant fucking</a> >:) -- [[Flnlmijk]] &new{2008-05-25 (日) 00:24:26}; - Excellent work, Nice Design <a href=" http://blogs.ign.com/BonyClarck/ "><b>discount airline tickets airlines</b></a> jxy -- [[Nutcnxnc]] &new{2008-05-25 (日) 02:18:23}; - Jonny was here <a href=" http://groups.google.us/group/l-free-hot-sex-movies ">fuckpic</a> 8(( -- [[Xvqajylk]] &new{2008-05-25 (日) 04:24:36}; - This site is crazy :) <a href=" http://groups.google.us/group/d-free-hot-sex-movies ">fathers butt fucking there daughters</a> 0475 -- [[Wkfbbjkr]] &new{2008-05-25 (日) 04:51:07}; - Thanks funny site <a href=" http://groups.google.us/group/w-free-hot-sex-movies ">havana ginger getting fucked</a> 7914 -- [[Fuddzehj]] &new{2008-05-25 (日) 06:27:05}; - this is be cool 8) <a href=" http://groups.google.us/group/f-free-hot-sex-movies ">hardcore pissing fising fucking porno</a> oio -- [[Olegleyw]] &new{2008-05-25 (日) 06:58:57}; - Best Site Good Work <a href=" http://groups.google.us/group/ww-free-hot-sex-movies ">black milfs fucking</a> huk -- [[Rujrzebh]] &new{2008-05-25 (日) 08:25:25}; - It's serious <a href=" http://groups.google.us/group/r-free-hot-sex-movies ">girl fucking horse</a> %-[[ -- [[Intdxijo]] &new{2008-05-25 (日) 09:07:43}; #comment