//
//Pin config
//
 ANSELG = 0; 
TRISGbits.TRISG6 = 0; //RP118 as output - SYNCO1 
TRISGbits.TRISG7 = 1; //RP119 as input - SYNCI1 
RPOR10bits.RP118R = 0b101101; //SYNCO1 to RP118 
RPINR37bits.SYNCI1R = 0b1110111; //SYNCI1 to RP119 
//
// Set synchronization from primary time base 
//
PTCONbits.SYNCOEN = 1; 
PTCONbits.SYNCPOL = 0; // Set synchronization for secondary time base 
STCONbits.SYNCPOL = 0; S
TCONbits.SYNCSRC = 0b000; 
STCONbits.SYNCEN = 1;
//