ad输入为通道0,电源接p0.27 地和电源地连接,程序启动后无法进入ad中断,不知什么原因?(监测ADDR一直为0)
初始化及中断函数如下:
void Adc_Init(void) { uint32 adc_data; PINSEL1 = PINSEL1 | 0x01400000; ADCR = (1 << 0) | ((Fpclk / 1000000 - 1) << 8) | (0 << 16) | //0 软件控制 如设成1可进中断 但其他任务不能运行 (0 << 17) | (1 << 21) | (0 << 22) | (0 << 24) | (0 << 27); VICIntSelect = 0x00000000; VICVectCntl6 = 0x32; VICVectAddr6 = (int)IRQ_ADC0; VICIntEnable = VICIntEnable | 0x00040000; // DelayMS(10); // ADdata = ADDR;
void __irq IRQ_ADC0(void) { uint32 bat; uint8 addata[2]; bat = VICIntEnable; VICIntEnable = 0; ADdata = ADDR; addata[0]=(uint8)(ADdata>>6); addata[1]=(uint8)(ADdata>>14);
VICVectAddr = 0x00; VICIntEnable = bat; }
|