CH552如何同時(shí)檢測(cè)兩路GPIO中斷

現(xiàn)在研究你們CH552單片機(jī),SOP16封裝,測(cè)試GPIO中斷,因?yàn)橐獙?shí)現(xiàn)編碼器,P1.4和P1.5同時(shí)設(shè)置為下降沿中斷,代碼如下,請(qǐng)問(wèn)在GPIOInterrupt中斷服務(wù)函數(shù)里面,怎么判斷是哪個(gè)GPIO產(chǎn)生了下降沿中斷呢?目前示例程序只有一句打印printf("GPIO_STATUS: %02x\n",(UINT16)(PIN_FUNC&bIO_INT_ACT)); 似乎只能知道是有下降沿產(chǎn)生了,具體是哪個(gè)GPIO,從哪里知道呢


void?GPIOInterruptCfg()
{
???GPIO_IE?&=?~bIE_IO_EDGE;
???GPIO_IE?|=?bIE_IO_EDGE;?????????????????????????????????????????????????????//?edge?trigger
???GPIO_IE?|=?bIE_P1_4_LO;?????????????????????????????????????????????????????//?GPIO?P1.4?falling?edge
???GPIO_IE?|=?bIE_P1_5_LO;?????????????????????????????????????????????????????//?GPIO?P1.5?falling?edge
	?GPIO_IE?|=?bIE_P3_1_LO;?????????????????????????????????????????????????????//?GPIO?P3.1?falling?edge(button?pressed)

???IE_GPIO??=?1;???????????????????????????????????????????????????????????????//GPIO????????
}



熱門(mén)產(chǎn)品 : CH390:以太網(wǎng)控制器芯片

另外,看到所有CH552所有的GPIO在邊沿中斷時(shí),好像只支持下降沿(falling)中斷,不支持上升沿(rising)中斷,是不是根本就沒(méi)法支持編碼器?


使用RST引腳的上升沿中斷+INT0或者INT1的下降沿中斷,分別屬于兩個(gè)不同的中斷源。


就是說(shuō),沒(méi)辦法使用上升沿,下降沿中斷來(lái)實(shí)現(xiàn)編碼器了,是吧


well usually for simple (mechanical) encoders timer will be used. This has the advatage that debouncing can be done easily. Pin interrupts are too fast for that.?

There is however one exeption:

For Hi Res Hispeed Encoders external interrupts may be used. These types are often optical and dont bounce.


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频