📄 comparatorsisr.c
字号:
#include <pic18.h>
#include "comparators.h"
#include <stdio.h>
void interrupt ISR(void)
{
if((RBIE)&&(RBIF)) /*Service PUSH button press*/
{
CMIE=0; /*Disable comparator interrupts while changing CMCON to avoid false interrupts*/
CVRCON=0; /*Clear Voltage reference control register*/
CMCON=DIP1; /*Update CMCON with new value*/
if ((CMCON&07)==6)CVRCON=0b10100000|(PORTC&0x0F); /*if Voltage reference is used load VREF value*/
RBIF=0;
CMIE=1; /*Enable comparator interrupts*/
UPDATE_REQUIRED=1;
}
if((CMIF)&&(CMIE)) /*Service comparator interrupt*/
{
CMIF=0;
UPDATE_REQUIRED=1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -