11.4.11.2.5 Blanking Time

IOIMBTCON.BLANK sets the blanking time. The mismatch event is valid after the blanking timer has counted down to zero. The blanking time is introduced to account for I/O pad delays or associated routing path delays in the feedback input with respect to reference input. Blanking time is reloaded into the blanking timer (as shown in IOIM Code) every time the reference pin is toggled to high.

IOIM Code

#include "xc.h"

int main(void) 
{
    IOIM1CONbits.ON = 0;          // module is turned off.
    IOIM1STAT = 0;                // clearing all status flags
    
    // both of the above steps clears the module status bits.
    
    IOIM1CONbits.TESTEN = 0x10;  // set 10 for FAULT injection mode and 11 for OK injection mode.
    IOIM1BCONbits.BLANK = 100;   // set to make sure the required delay is given between reference and feedback.

    // we dont need to select any any reference and feedback pins as it is internal
    
    IOIM1CONbits.EOVFVAL = 10;   // set err count overflow value
    
    _IOM1IF = 0; //clear interrupt flag
    _IOM1IE = 1; //enable interrupt
    
    IOIM1CONbits.FLTINJ = 0;     // make sure fault inject is clear
    //IOIM1CONbits.OKINJ = 0;    // make sure ok inject is clear
    
    IOIM1CONbits.ON = 1;         // module is turned on
    
    IOIM1CONbits.FLTINJ = 1;     // set to inject fault condition
//    IOIM1CONbits.OKINJ = 1;    // set to inject ok condition
    
    while(1);
    
    return 0;
}

void __attribute__((interrupt, no_auto_psv)) _IOIM1Interrupt(void) 
{
   
    _IOM1IF = 0;                // clear interrupt flag
    IOIM1STATbits.ERR = 0;
}