Thanks Tom,
Here is the code, which came with my Netburner IDE:
/*******************************************************************************
*FUNCTION : fs_etpu_qd_set_pc_interrupts
*PURPOSE : This function changes the pc_interrupt values.
*INPUTS NOTES : This function has 3 parameters:
* channel_primary - This is the Primary channel number (Phase A).
* 0-31 for ETPU_A and 64-95 for ETPU_B.
* pc_interrupt1 - This is the pc_interrupt1 value to be set.
* pc_interrupt2 - This is the pc_interrupt2 value to be set.
*
*RETURNS NOTES: Error code that can be returned is: FS_ETPU_ERROR_VALUE.
*******************************************************************************/
int32_t fs_etpu_qd_set_pc_interrupts(uint8_t channel_primary,
int24_t pc_interrupt1,
int24_t pc_interrupt2)
{
/* Parameters bounds check */
#ifdef FS_ETPU_MC_PARAM_CHECK
if(((channel_primary>31)&&(channel_primary<64))||(channel_primary>95))
{
return(FS_ETPU_ERROR_VALUE);
}
#endif
fs_etpu_set_chan_local_24(channel_primary, FS_ETPU_QD_PCINTERRUPT1_OFFSET,
(uint24_t)pc_interrupt1);
fs_etpu_set_chan_local_24(channel_primary, FS_ETPU_QD_PCINTERRUPT2_OFFSET,
(uint24_t)pc_interrupt2);
return(0);
}
I've looked at the other ANs, they haven't shed any light. I'm pretty sure that most of them are outdated, as they reference the eTPU function sets, which I don't think are used in the current code.
My code is working, I've just set both pc1 and pc2 to the same value.
The other thing I'm puzzling over is whether I need to check interrupts from both the primary and the secondary channels. Right now I am, and it seems that, while moving in the same direction, sometimes one channel interrupts, and sometimes the other.