Package Project

Right click project and select 'Package'. This will create a zip which includes all the file in the project (look in the output box to see where it got saved).  Its a handy way of sending a project to others, archiving a project etc. A benefit is it will remove other projects and files in […]

Read More

ICD3 Target detected – Unable to connect to the target device.

Issue: Trying to debug or program using a ICD3 with MPLAB X gives this error: Target detected Unable to connect to the target device. Cause ICD3 has previously been used with MPLAB IPE V3.xx and you are now using IPE or MPLABX V2.xx We discovered this after using IPE V3.35 and then using MPLABX & IPE V2.15.  Solution […]

Read More

I2C Master

The legacy versions of Plib I2C has code for I2C1 and I2C2 only.  When you try and use fro I2C3, I2C4 etc you're buggered.  You have to use the modern I2C functions instead which is just great because they are horribly documented and don't have direct equivalents for things like IdleI2C1(). Setup I2C Bus //—– SETUP […]

Read More

Interupt Flags

Test Interrupt if (INTGetFlag(INT_SPI1)) Clear Interrupt INTClearFlag(INT_T5); Is Interrupt Enabled if (!INTGetEnable(INT_INT0)) ConfigINT0(EXT_INT_PRI_7 | RISING_EDGE_INT | EXT_INT_ENABLE);  

Read More

Peripheral Pin Select

To set or clear the IOLOCK bit, an unlock sequence must be executed: #define PPSUnLock() {SYSKEY=0x0; SYSKEY=0xAA996655; SYSKEY=0x556699AA; CFGCONbits.IOLOCK=0;} #define PPSLock() {SYSKEY=0x0; SYSKEY=0xAA996655; SYSKEY=0x556699AA; CFGCONbits.IOLOCK=1;} Note these defines are likely already included in xc32 UART DISABLE_INT; PPSUnLock() //PPS Unlock (required before setting peripheral pin, if config bit IOL1WAY is set only 1 change of IOLOCK […]

Read More

List Files – XC8

If necessary enable the "Generate the ASM Listing File" option in project settings. The file lst and map files are in the "dist/default/debug directory" or "dist/default/production/" directory.

Read More

INT Pin IRQs

Interrupt based INT pin handler //—– SETUP INT 0 PIN —– ConfigINT0(EXT_INT_PRI_7 | RISING_EDGE_INT | EXT_INT_ENABLE); //Priority, edge trigger, enable. This also clears the irq flag   //********************************** //********** INT0 PIN IRQ ********** //********************************** void __ISR(_EXTERNAL_0_VECTOR, IPL7SOFT) External_Interrupt_0(void) //(<<<<<<< IPL# must match the priority level assigned to the irq where its enabed, Use 'SRS' if […]

Read More