熱門: 51單片機(jī) | 24小時(shí)必答區(qū) | 單片機(jī)教程 | 單片機(jī)DIY制作 | STM32 | Cortex M3 | 模數(shù)電子 | 電子DIY制作 | 音響/功放 | 拆機(jī)樂園 | Arduino | 嵌入式OS | 程序設(shè)計(jì)
![]() |
發(fā)布時(shí)間: 2019-11-1 17:54
正文摘要:void up() { digitalWrite(12, HIGH); delayMicroseconds(5000); digitalWrite(12, LOW); delayMicroseconds(1000); digitalWrite(12, HIGH); ... |
jzli2019 發(fā)表于 2019-11-4 18:03 呵呵8.8 |
taotie 發(fā)表于 2019-11-4 17:12 你用的是哪個(gè)版本,我感覺就是版本不對(duì)導(dǎo)致的。。。 |
taotie 發(fā)表于 2019-11-4 17:12 大佬,我把proteus8.7卸載了重新裝了proteus8.9,現(xiàn)在模擬也沒問題了。。。很莫名其妙啊 |
按你的程序仿真沒得問題。。![]() |
jzli2019 發(fā)表于 2019-11-4 14:33 Arduino Dimming 230V AC |
taotie 發(fā)表于 2019-11-4 10:31 這個(gè)例子名稱叫什么,我想看看完整項(xiàng)目 |
檢測到過零后延時(shí)5ms控制moc3021開通???? 用10ms試一試~~ |
這是Proteus 8 中的例程看一看吧 /* Main.ino file generated by New Project wizard * * Created: mer ago 22 2018 * Processor: Arduino Uno * Compiler: Arduino AVR */ int AC_LOAD = 3; // Output to Opto Triac pin int dimming = 128; // Dimming level (0-128) 0 = ON, 128 = OFF void setup() { pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output attachInterrupt(0, zero_crosss_int, RISING); // Choose the zero cross interrupt # from the table above } //the interrupt function must take no parameters and return nothing void zero_crosss_int() //function to be fired at the zero crossing to dim the light { // Firing angle calculation : 1 full 50Hz wave =1/50=20ms // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle) // For 60Hz => 8.33ms (10.000/120) // 10ms=10000us // (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65 int dimtime = (75*dimming); // For 60Hz =>65 delayMicroseconds(dimtime); // Wait till firing the TRIAC digitalWrite(AC_LOAD, HIGH); // Fire the TRIAC delayMicroseconds(10); // triac On propogation delay (for 60Hz use 8.33) digitalWrite(AC_LOAD, LOW); // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC } void loop() { for (int i=5; i <= 128; i++){ dimming=i; delay(10); } } |
沒有人嗎? |
Powered by 單片機(jī)教程網(wǎng)