|
|||||||||||
| 技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測(cè)控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng) 驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe |
請(qǐng)教一個(gè)變量賦值的問(wèn)題 |
| 作者:不辣的皮特 欄目:單片機(jī) |
/ ADC end-of-conversion ISR // Here we take the ADC SAMPLE, add it to a running total <accumulator>, and // decrement our local decimation counter <int_dec>. When <int_dec> reaches // zero, we calculate the new VALUE of the GLOBAL variable <result>, // which stores the accumulated ADC result. // void ADC_isr (void) interrupt 15 { static unsigned int_dec=256; // integrate/decimate counter // we post a new result when // int_dec = 0 static LONG accumulator=0L; // heres where we integrate the // ADC SAMPLEs ADCINT = 0; // clear ADC conversion complete // indicator accumulator += ADC0; // read ADC VALUE and add to running // total int_dec--; // update decimation counter if (int_dec == 0) { // if zero, then decimate int_dec = 256; // reset counter result = accumulator >> 4; // Shift to perform the divide operation accumulator = 0L; // dump accumulator } } 我的問(wèn)題是:int_dec 和 accumulator 這兩個(gè)變量的賦值是不是應(yīng)該放在中斷服務(wù)程序的外面? |
|
|
| 免費(fèi)注冊(cè)為維庫(kù)電子開(kāi)發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入 |
Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號(hào) |