Hi, Folks
I have a GPCT0 timer which will generate interrupt. with a oscilloscope, every time I run the code I saw a pulse was generated at the G0 output, but the isr run 51 times when I open the NI SPY to monitor it. When I turned off the NI SPY, it happened 6 to 8 times. I enabled the visa event, then configured the timer and turned on the hardware interrupt. Here is the code in main:
// enable the G0_TC interrupt
theSTC->Interrupt_A_Enable.setG0_TC_Interrupt_Enable(1);
theSTC->Interrupt_A_Enable.setG0_Gate_Interrupt_Enable(0);
theSTC->Interrupt_A_Enable.flush();
theSTC->Analog_Trigger_Etc.setGPFO_0_Output_Select(0);
theSTC->Analog_Trigger_Etc.setGPFO_0_Output_Enable(1);
theSTC->Analog_Trigger_Etc.flush();
// enable the interrupt A
theSTC->Interrupt_Control.setRegister(0); // reset complete register
theSTC->Interrupt_Control.setInterrupt_Output_Polarity(theSTC->Interrupt_Control.kInterrupt_Output_PolarityActive_Low);
theSTC->Interrupt_Control.setInterrupt_A_Output_Select(0);
theSTC->Interrupt_Control.setInterrupt_A_Enable(1);
theSTC->Interrupt_Control.flush();
// start to run the timer
theSTC->G0_Command.writeG0_Arm(1);
Here is code in the isr:
ViStatus _VI_FUNCH IHandler(ViSession vi, ViEventType etype, ViEvent event, ViAddr uhandle)
{
tAddressSpace Bar0, Bar1;
tESeries *board;
tSTC *theSTC;
tMITE *mite;
Bar0 = bus->createAddressSpace(kPCI_BAR0);
Bar1 = bus->createAddressSpace(kPCI_BAR1);
mite = new tMITE(Bar0);
board = new tESeries(Bar1);
theSTC = new tSTC(Bar1);
i = i++;
theSTC->Interrupt_A_Ack.writeG0_TC_Interrupt_Ack(1);
theSTC->Interrupt_A_Enable.writeG0_TC_Interrupt_Enable(0);
theSTC->Interrupt_Control.writeInterrupt_A_Enable(0);
/*
(function code here)
*/
mite->LocalCpuInterruptMask2.setSetCpuIntIE(1);
delete mite;
delete theSTC;
delete board;
bus->destroyAddressSpace(Bar0);
bus->destroyAddressSpace(Bar1);
return VI_SUCCESS;
}
I suspect that there may be someting wrong with data passing between main and isr, don't know for sure.
Any help and advice will be appreciated greatly.
Best regards,
George