#freeze 閲覧総計:&counter(); (本日:&counter(today); 昨日:&counter(yesterday);)~ ~ *発光ダイオード(LED)の明るさを変える [#e8372b5b] PIC 16F628A内臓のPWM機能を利用し、発光ダイオードの明るさを徐々に変えてみよう。 06/10/28 注)16F628Aの場合、PWM信号はRB3から発信される。 関連MikroC関数 void Pwm_Init(unsigned long freq); void Pwm_Change_Duty(unsigned short duty_ratio); void Pwm_Start(void); void Pwm_Stop(void); |&attachref(LEDの明るさを変える.JPG,zoom,150x150,button){新しい写真添付};|&attachref(LEDの明るさを変える.jpg,zoom,150x150,button){新しい写真添付};| /** * PWM機能で発光ダイオードの明るさを徐々に変える * PIC 16F628A * 発信器:内臓4MHz * 電源:乾電池3本 * RB3: LED (CCP出力) * RB2: LED (照度比較用) * Device Flags: _BODEN_OFF _BOREN_OFF _CP_OFF _PWRTE_ON _WDT_OFF * _LVP_OFF _MCLRE_OFF _INTRC_OSC_NOCLKOUT * 言語 MikroC v6.2 */ void main(){ //メイン プログラム unsigned short int i; //使用変数の定義 PORTB = 0b00000000; //PORTBの中身をきれいにする TRISB = 0b00000010; //RB1は1:入力、他のPORTBは0:出力に設定 PWM_Init(5000); //PWMの初期化 (5KHz周期指定) PORTB.F2 = 1; //照度比較用LED ON PWM_Start(); //PWM機能スタート do { //doとwhileの間を繰り返す //LEDの明るさを徐々に変える for (i = 0; i < 256; i++) { PWM_Change_Duty(i); //PWMのDuty変更 Delay_ms(100); //100msec待つ } } while(1); //doとwhileの間を繰り返す } //メイン プログラム終了 ★この情報は役に立ちましたか? #vote(はい[5],いいえ[3]) - このプログラムの追加で徐々に減光するプログラムを書いているときに気が付きましたが、for条件式iの比較値が256ですと255からインクリメントした際にiが0になりforループから抜けられなくなるようです。 -- [[Mojo]] &new{2008-01-29 (火) 17:32:40}; - KIgIPxwRv -- [[aahyiks]] &new{2008-07-14 (月) 14:19:45}; - Very Good Site <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=174&post=gayporn.htm ">teenchat</a> 8-]]] <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=175&post=gayporno.htm ">deepanalsex</a> %-[[ <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=164&post=gayboys.htm ">freeanalsexclip</a> 569040 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=151&post=ebonysex.htm ">sexymen</a> 848 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=169&post=gayhentai.htm ">freepornvideo</a> 635630 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=160&post=freeporno.htm ">cuteteen</a> :-]]] <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=147&post=cocksucking.htm ">analsexguide</a> 055160 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=146&post=cockrings.htm ">gaytruckers</a> wsgap <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=161&post=fuckpic.htm ">analgreenguy</a> 751278 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=172&post=gaymen.htm ">freeporntrailers</a> 4923 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=16&post=firstanalsex.htm ">hardcorehentai</a> 223 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=185&post=hardcoreanal.htm ">deepanalsex</a> tbt <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=168&post=gayguys.htm ">analsexvideo</a> =-] <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=17&post=extremeanalsex.htm ">ebonyanalsex</a> gkmeyy <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=170&post=gaymarriage.htm ">analsexhemorrhoids</a> 42789 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=181&post=goodpussy.htm ">freepornforcedsex</a> bdjmb <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=163&post=gayanal.htm ">sexyfeet</a> :-DD <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=158&post=freepussy.htm ">teentits</a> 0473 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=19&post=analmasterclasssex.htm ">gayporno</a> yzbwed <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=167&post=gayfuck.htm ">analsexguide</a> 009 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=154&post=fatpussy.htm ">xxxcreatures</a> =PPP <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=173&post=gaypersonals.htm ">hardcorehentai</a> :)) <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=177&post=gayrape.htm ">freepornpics</a> 334604 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=155&post=forcedsex.htm ">sexymodels</a> =((( <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=189&post=hardcorehentai.htm ">dicksuckers</a> pybmty <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=183&post=hairlesspussy.htm ">freeporntrailers</a> 371193 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=165&post=gaycbt.htm ">blackanalsex</a> 643427 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=145&post=freepornpics.htm ">analsexforman</a> dst <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=187&post=hardcorefuck.htm ">firsttimeanalsex</a> =O <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=157&post=freegay.htm ">xxxsex</a> %))) <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=166&post=gaycock.htm ">teenpussy</a> 8P <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=171&post=gaymarriages.htm ">analsexvideo</a> 210 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=150&post=dogfuckers.htm ">analfucking</a> cyg <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=190&post=hardcoreporn.htm ">nicetits</a> 237062 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=180&post=girlsex.htm ">painfulanalsex</a> 83924 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=148&post=cuteteen.htm ">freeanalsexgallery</a> 401 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=178&post=gaytruckers.htm ">analsexguide</a> vrhqt <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=153&post=farmsex.htm ">straponanalsex</a> rgwe <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=156&post=freeblowjobs.htm ">teentiny</a> 8-((( <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=182&post=greenguysporn.htm ">analfisting</a> owvfem <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=188&post=hardcorefucking.htm ">hardcorefuck</a> 8D <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=159&post=freeporn.htm ">analfissure</a> yyofvh <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=152&post=ebonythumbs.htm ">analgreenguy</a> ziup <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=18&post=asiananalsex.htm ">gaytruckers</a> 99138 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=149&post=dicksuckers.htm ">sexysecretaries</a> :P <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=176&post=gaypron.htm ">xxxvouge</a> uuic <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=179&post=ghettoporno.htm ">analsexguide</a> dzlluz <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=186&post=hardcorefree.htm ">freeonlinepornopictures</a> 957781 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=162&post=fuckmymom.htm ">hardcorehentai</a> 232963 <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=184&post=hairypussy.htm ">firsttimeanalsex</a> %[[ <a href=" http://hotfreevids.0catch.com/forum/TOPIC_ID=15&post=analsexpicture.htm ">xxxcreatures</a> %OOO -- [[Friqcmhs]] &new{2008-07-23 (水) 23:40:16}; #comment