Hello
I do not know about C code.
I want to generate very short pulses in the MHz range.
If possible around 50MHz
I want to run the following microchip example in FC7.
Example from DS61111E-Page 16
I have a PIC32MZ2048EFM100
Clock runs at 200MHz.
The impulses should appear on port C2
Up to this line no error message comes.
Example code for Output Compare 1 ISR:
what is missing here or is wrong
![Confused :?](./images/smilies/icon_confused.gif)
Thanks in advance
################################################################################
// The following code example will set the Output Compare 1 module
// for interrupts on the continuous pulse event and select Timer2
// as the clock source for the compare time-base.T2CON = 0x0018;
// Configure Timer2 for 32-bit operation
// with a prescaler of 2. The Timer2/Timer3
// pair is accessed via registers associated
// with the Timer2 register
OC1CON = 0x0000; // disable OC1 module
OC1CON = 0x0005; // Configure OC1 module for Pulse output
OC1R = 0x3000; // Initialize Compare Register 1
OC1RS = 0x3003; // Initialize Secondary Compare Register 1
PR2 = 0x00500000; // Set period (PR2 is now 32-bits wide)
// configure int
IFS0CLR = 0x00000040; // Clear the OC1 interrupt flag
IFS0SET = 0x00000040; // Enable OC1 interrupt
IPC1SET = 0x001C0000; // Set OC1 interrupt priority to 7,
// the highest level
IPC1SET = 0x00030000; // Set Subpriority to 3, maximum
T2CONSET = 0x8000; // Enable Timer2
OC1CONSET = 0x8000; // Enable OC1
// Example code for Output Compare 1 ISR:
void__ISR(_OUTPUT_COMPARE_1_VECTOR, ipl7) OC1_IntHandler (void)
{
// insert user code here
IFS0CLR = 0x0040; // Clear the OC1 interrupt flag
}