我的IO初始化是不是有点问题,PA口输出电平不对,是不是我忽略了什么 if ( 1 ) { ADCSC1 = 0x00; /*A¿Ú³õʼ»¯*/ PTADD = (unsigned char)0xFF; PTAPE = (unsigned char)0x00;//½ûÖ¹A¿ÚÉÏÀ PTASE = (unsigned char)0x00;//²»ÏÞÖÆA¿Ú°ÚÂÊ PTADS = (unsigned char)0x0F; PTASC = (unsigned char)0x00; PTAPS = (unsigned char)0x00; PTAES = (unsigned char)0x00; PTAD = (unsigned char)0xFF; /*B¿Ú³õʼ»¯*/ PTBDD = (unsigned char)0x06; PTBPE = (unsigned char)0x00;//½ûÖ¹B¿ÚÉÏÀ PTBSE = (unsigned char)0x00;//²»ÏÞÖÆB¿Ú°ÚÂÊ PTBDS = (unsigned char)0x00; PTBSC = (unsigned char)0x00; PTBPS = (unsigned char)0x00; PTBES = (unsigned char)0x00; PTBD = (unsigned char)0x00; /*C¿Ú³õʼ»¯*/ PTCDD = (unsigned char)0xFB;//·½Ïò¿Ú¿ØÖÆ PTCPE = (unsigned char)0x00;//½ûÖ¹ÉÏÀ PTCSE = (unsigned char)0x00;//²»ÏÞÖÆ°ÚÂÊ PTCDS = (unsigned char)0x08;//½ûֹǿÇý¶¯ PTCD = (unsigned char)0x00; //GNGC = £¨unsigned char)0x00;? PTCD = (unsigned char)0x00; ADCSC1 = 0x00; } else{ } 是不是还有什么寄存器需要设置一下,变成普通的IO使用 |