Jump to content
OMRON Forums

Edge detection fail in Capture/Compare Interrupt Service Routine


RafaelFalcaro

Recommended Posts

Hello, I'm using PowerPMAC's ISR interrupt to perform axes position acquisition, with the trigger source being the UserFlag signal.

The implementation is functional, however the interrupt is being executed at each edge of the trigger, regardless of its direction (rising or falling).

I would like the interrupt to happen only on the falling edge of the UserFlag signal. Here are the settings I made:

Gate3[0].IntCtrl = $10000
Gate3[0].Chan[0].CaptCtrl = 10
Gate3[0].Chan[0].CaptFlagSel = 3
Gate3[0].Chan[0].CaptFlagChan = 0
UserAlgo.CaptCompIntr = 1

Here is the code inside the ISR:

void CaptCompISR (void)
{
	volatile GateArray3 *MyFirstGate3IC; // ASIC structure pointer
	int *CaptCounter; // Logs number of triggers
	int *CaptPosStore; // Storage pointer
	MyFirstGate3IC = GetGate3MemPtr(0); // Pointer to IC base
	CaptCounter = (int *)pushm + 65535; // Sys.Idata[65535]
	CaptPosStore = (int *)pushm + *CaptCounter + 65536;
	*CaptPosStore = MyFirstGate3IC->Chan[0].HomeCapt; // Store in array
	(*CaptCounter)++; // Increment counter
	MyFirstGate3IC->IntCtrl = 1; // Clear interrupt source
}

 

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Hi @Sangmo, thanks for the reply!

 

So I understand that the ISR function is executed on any edge of my trigger signal, is that right?
I'm asking because in the Power PMAC User Manual (page 787) there is an information that for PMAC3-style ICs the detection is done via “edge-triggered” capture logic:

 

image.thumb.png.8245acc52d259f49410f78be63afb3f2.png

 

If this is correct, what is the need to configure the Gate3[0].Chan[0].CaptCtrl register, since it only matters which trigger source (Gate3[0].Chan[0].CaptFlagSel)?

 

Edited by RafaelFalcaro
Link to comment
Share on other sites

@steve.milici

did some tests to validate the maximum input frequency in the "user flag" that I can trigger the ISR and it is significantly lower than when I use the encoder index. You know why?
Is there any difference in the detector circuit?


User flag/home flag: ~12,5kHz
Index encoder: ~50kHz

PS: I' using Power Brick LV-IMS. 

Edited by rleoni
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...