void APP_Initialize ( void ) { /* Place the App state machine in its initial state. */ appData.state = APP_STATE_INIT; appData.deviceIsConnected = false; /* TODO: Initialize your application's state machine and other * parameters. */ //変化割込みバグ対策 #undef SYS_PORT_A_CNEN #define SYS_PORT_A_CNEN 0x0010 /* PORT A Initialization */ PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_ODC); PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_LAT); PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_TRIS ^ 0xFFFF); PLIB_PORTS_ChangeNoticePerPortTurnOn(PORTS_ID_0, PORT_CHANNEL_A); PLIB_PORTS_ChannelModeSelect(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_ANSEL ^ 0xFFFF, PORTS_PIN_MODE_DIGITAL); PLIB_PORTS_ChannelChangeNoticeEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_CNEN); PLIB_PORTS_ChannelChangeNoticePullUpEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_CNPU); PLIB_PORTS_ChannelChangeNoticePullDownEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_CNPD); PLIB_PORTS_Read(PORTS_ID_0, PORT_CHANNEL_A); PLIB_INT_SourceFlagClear(INT_ID_0, INT_SOURCE_CHANGE_NOTICE_A); PLIB_INT_SourceEnable(INT_ID_0, INT_SOURCE_CHANGE_NOTICE_A); PLIB_INT_VectorPrioritySet(INT_ID_0, INT_VECTOR_CHANGE_NOTICE_A, INT_PRIORITY_LEVEL1); PLIB_INT_VectorSubPrioritySet(INT_ID_0, INT_VECTOR_CHANGE_NOTICE_A, INT_SUBPRIORITY_LEVEL0); #undef SYS_PORT_G_CNEN #define SYS_PORT_G_CNEN 0x8000 /* PORT G Initialization */ PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_ODC); PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_LAT); PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_TRIS ^ 0xFFFF); PLIB_PORTS_ChangeNoticePerPortTurnOn(PORTS_ID_0, PORT_CHANNEL_G); PLIB_PORTS_ChannelModeSelect(PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_ANSEL ^ 0xFFFF, PORTS_PIN_MODE_DIGITAL); PLIB_PORTS_ChannelChangeNoticeEnable(PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_CNEN); PLIB_PORTS_ChannelChangeNoticePullUpEnable(PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_CNPU); PLIB_PORTS_ChannelChangeNoticePullDownEnable(PORTS_ID_0, PORT_CHANNEL_G, SYS_PORT_G_CNPD); PLIB_PORTS_Read(PORTS_ID_0, PORT_CHANNEL_G); PLIB_INT_SourceFlagClear(INT_ID_0, INT_SOURCE_CHANGE_NOTICE_G); PLIB_INT_SourceEnable(INT_ID_0, INT_SOURCE_CHANGE_NOTICE_G); PLIB_INT_VectorPrioritySet(INT_ID_0, INT_VECTOR_CHANGE_NOTICE_G, INT_PRIORITY_LEVEL1); PLIB_INT_VectorSubPrioritySet(INT_ID_0, INT_VECTOR_CHANGE_NOTICE_G, INT_SUBPRIORITY_LEVEL0);
…… ……