我在测试PIC24FJ128GA310的芯片工作是否正常,将下述程序编译下载到芯片中,可是芯片没有任何反应,RB11管脚也没有置低,这是为什么?求大侠帮助。
#include "p24FJ128GA310.h"
//#include <p24fxxxx.h>
#define FCY 5529600
void InitIO()
{
ANSB = 0x0000;
ANSC = 0x0000;
ANSD = 0x0000;
ANSE = 0x0000;
ANSG = 0x0000;
//SD pin define
TRISDbits.TRISD14 = 0; //SDO
TRISBbits.TRISB14 = 0; //CLK
TRISDbits.TRISD15 = 0; //CS
TRISBbits.TRISB15 = 1; //DIN
TRISBbits.TRISB12 = 1; //CHK
//ADC pin define
TRISCbits.TRISC3 = 0; //SDO
TRISCbits.TRISC1 = 0; //CLK
TRISCbits.TRISC2 = 0; //CS
TRISCbits.TRISC4 = 1; //DIN
//MFlash pin define
TRISFbits.TRISF7 = 0; //SDO
TRISFbits.TRISF4 = 0; //CLK
TRISAbits.TRISA4 = 0; //CS
TRISAbits.TRISA10 = 1; //DIN
__builtin_write_OSCCONL(OSCCON & 0xbf);
//Uart1 pin define RP8-RX1 RP9-TX1
RPINR18bits.U1RXR = 8;
RPOR4bits.RP9R = 3;
//Uart2 pin define RPI32-RX2 RP31-TX2
RPINR19bits.U2RXR = 32;
RPOR15bits.RP31R = 5;
//Uart3 pin define RP30-RX3 RP15-TX3
RPINR17bits.U3RXR = 30;
RPOR7bits.RP15R = 28;
//Uart4 pin define RP17-RX4 RP16-TX4 RF Uart
RPINR27bits.U4RXR = 17;
RPOR8bits.RP16R = 30;
//RF pin define
//Switch pin define
TRISBbits.TRISB3 = 0; //switch c:enable
ODCBbits.ODB3 = 1; //开路输出
TRISBbits.TRISB4 = 0; //switch c:A
TRISBbits.TRISB5 = 0; //switch c:B
TRISGbits.TRISG6 = 0; //switch a:enable
ODCGbits.ODG6 = 1; //开路输出
TRISGbits.TRISG7 = 0; //switch a:A
TRISGbits.TRISG8 = 0; //switch a:B
TRISAbits.TRISA0 = 0; //switch a:C
TRISGbits.TRISG9 = 0; //switch b:enable
ODCGbits.ODG9 = 1; //开路输出
//IO pin define
//LED pin define
//Analog pin define
__builtin_write_OSCCONL(OSCCON | 0x40);
}
_CONFIG1 (JTAGEN_OFF &GCP_OFF &GWRP_OFF &ICS_PGx1 &FWDTEN_WDT_HW &WINDIS_OFF &FWPSA_PR128 &WDTPS_PS512 )
_CONFIG2 (POSCMD_XT &FNOSC_PRI &OSCIOFCN_ON &FCKSM_CSECME)
//_CONFIG3 (SOSCSEL_ON)
int main()
{
while(1)
{
TRISBbits.TRISB11=0;
PORTBbits.RB11=0;
}
return 0;
}
一周热门 更多>