weixin_58258853
2022-06-23 15:51
采纳率: 0%
浏览 21

为什么我硬件仿真adc进入不了中断 芯片sh88f2051

void InitADC()
{
ADCH = 0X01 ; //P1.0作为AD
ADCON = 0X80; //使能ADC AN0
ADT = 0X88;
ADDH = 0X00;
ADDL = 0X00;
}

void main()
{
P1M0 = 0X02; //P1.1高阻输入
P1M1 = 0X00;

P3M0 = 0X00;
P3M1 = 0X00;

P4M0 = 0X00;
P4M1 = 0X00;

EA = 1;
EADC = 1;
IPL0 = 0X40;
IPH0 = 0X40;

InitADC();
ADCON |=0X01;    //启动ADC

while(1)
    {
        AD10_store =(AD10_store|ADDH)&0x00ff;
        Value = (AD10_store<<2)|(ADDL&0X03);        
        Vout = (Value*5)/1023;
        V = Vout;
        displayS(V);
        ADCON |=0X01;
    }

}

void ADC() interrupt 6
{
ADCON &= 0XBF;
}

2条回答 默认 最新

相关推荐 更多相似问题