看板 ASM 關於我們 聯絡資訊
※ 引述《GooLoo (古若)》之銘言: : 請問MCU的中斷一定是LOW ACTIVE嗎? : 有辦法變HIGH ACTIVE嗎?? : 因為我想要PULSE來才動作,而非LOW就動作.... 請問一下,我使用interrup system測試 當我將 INT0(P32) =0時,的確有進中斷,然後在讓他等於1 我發現cnt一直是....<5耶?為什麼??? 我讓它為0很久,它應該會cnt++ 到很大才對 為什麼一直xy keep在00呢? #include <stdio.h> #include <Winbond.h> unsigned short cnt; void Main(void) { EA = 1;//致能整體中斷 EX0 = 1;//致能外部INT0中斷 x = 0; y = 0; while(1) { if (pulse < 5) { x = 0; y = 0; cnt = 0; } else if (pulse < 100) { x = 1; y = 0; cnt = 0; } else { x = 0; y = 1; cnt = 0; } } } void EX0_int(void) interrupt 0 using 1 { cnt++; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.194.110 ※ 編輯: GooLoo 來自: 123.195.194.110 (04/02 21:31)