- 追加された行はこの色です。
- 削除された行はこの色です。
#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};
- magic story very thanks <a href=" http://groups.google.us/group/c-free-hot-sex-movies ">horse fucking fat girls</a> pfvf -- [[Bakehrpr]] &new{2008-05-25 (日) 11:19:37};
- very best job <a href=" http://groups.google.us/group/s-free-hot-sex-movies ">my daughters fucking a nigger</a> hog -- [[Gbildzuv]] &new{2008-05-25 (日) 12:30:35};
- real beauty page <a href=" http://groups.google.us/group/v-free-hot-sex-movies ">daddy fucks me</a> lpchkj -- [[Xaqqneej]] &new{2008-05-25 (日) 13:27:38};
- perfect design thanks <a href=" http://groups.google.us/group/x-free-hot-sex-movies ">wwwfuck granny</a> lcpbsw -- [[Elphfckd]] &new{2008-05-25 (日) 14:35:01};
- It's serious <a href=" http://groups.google.us/group/t-free-hot-sex-movies ">girls who fuck guys</a> 63482 -- [[Hjqxmasz]] &new{2008-05-25 (日) 15:39:01};
- real beauty page <a href=" http://groups.google.us/group/xx-free-hot-sex-movies ">somebody to fuck</a> bcwar -- [[Fszogplm]] &new{2008-05-25 (日) 16:43:06};
- I love this site <a href=" http://groups.google.us/group/g-free-hot-sex-movies ">fuckmywife</a> =-]] -- [[Wjkhrerg]] &new{2008-05-25 (日) 17:54:56};
- It's funny goodluck <a href=" http://groups.google.us/group/xl-free-hot-sex-movies ">party fucking elders</a> vrqc -- [[Mvcjucij]] &new{2008-05-25 (日) 18:54:31};
- i'm fine good work <a href=" http://groups.google.us/group/j-free-hot-sex-movies ">fucktube</a> xtia -- [[Rbgxebej]] &new{2008-05-25 (日) 20:08:54};
- Best Site Good Work <a href=" http://www.gamesforum.ca/showthread.php?t=298398 ">sweet sixteen party</a> dgqxuv -- [[Zvuaefkj]] &new{2008-05-25 (日) 21:02:53};
- Cool site goodluck :) <a href=" http://www.gamesforum.ca/showthread.php?t=298418 ">puertorican porn</a> 6512 -- [[Vsxufgyd]] &new{2008-05-25 (日) 22:25:53};
- perfect design thanks <a href=" http://www.gamesforum.ca/showthread.php?t=298410 ">preteenporn</a> 7980 -- [[Esotihxx]] &new{2008-05-25 (日) 23:15:24};
- Wonderfull great site <a href=" http://www.gamesforum.ca/showthread.php?t=298422 ">forced rape porn</a> dmsj -- [[Kdpcpbtu]] &new{2008-05-26 (月) 00:47:14};
- It's funny goodluck <a href=" http://www.gamesforum.ca/showthread.php?t=298411 ">free adult anal porn movies</a> 168 -- [[Jbhwxnoi]] &new{2008-05-26 (月) 01:31:15};
- Wonderfull great site <a href=" http://www.gamesforum.ca/showthread.php?t=298423 ">3d porn galleries</a> bro -- [[Mrkvafyi]] &new{2008-05-26 (月) 03:01:31};
- It's serious <a href=" http://www.gamesforum.ca/showthread.php?t=298425 ">fun free toon porn games</a> 7602 -- [[Zrglxpig]] &new{2008-05-26 (月) 05:13:50};
- good material thanks <a href=" http://www.gamesforum.ca/showthread.php?t=298413 ">ghettopornstarz</a> 15556 -- [[Dmbzvkaa]] &new{2008-05-26 (月) 05:49:54};
- good material thanks <a href=" http://www.gamesforum.ca/showthread.php?t=298426 ">ree porn . com</a> tkjz -- [[Lurfejgs]] &new{2008-05-26 (月) 07:24:23};
- Best Site Good Work <a href=" http://www.sitepoint.com/forums/showpost.php?p=3830335&postcount=2 ">saint louis airline tickets</a> >:) -- [[Hofvpmho]] &new{2008-05-26 (月) 07:52:06};
#comment