Hi
We are working on interfacing the SM470R1B1M-HT Microcontroller with a motor resolver, so we are employing the HET for this.
We need the HET to generate a 50% duty-cycle PWM at 8 Khz, and to trigger an interrupt at certain point of each clock cycle. I have got the PWM generating the expected square wave; however, I still can not get the HET interrupt working at all.
I have copied the HET and the C code below, would you please advise me if you have any suggestions
Thanks in advance
HET CODE
L00: CNT {next=L01, reg=T, irq=On, max=0x750, data=0}
; PWM (50% duty cycle)
L01: ECMP {next=L02, reg=T, hr_lr=HIGH, en_pin_action=ON, pin=CC6, action=PULSELO, irq=On, data=0x3A8}
L02: BR {next=L00, cond_addr=L00, event=NOCOND}
C Code
int main(void)
{
// Set up peripheral registers.
// First disable interrupts.
__disable_interrupt();
PCR = 0x1E;
PCR = 0x1F; // enable peripherals
/* copy HET instructions to HET ram*/
MemCopy32((void *) &e_HETPROGRAM0_UN, (void *) HET_INIT0_PST, sizeof(HET_INIT0_PST));
HETPFR = HRPRES_FACTOR_1 | LRPRES_FACTOR_4;// 0x0000052b; /* Set PFR register */
HETDIR |= Het6+Het2; /* Set pin directions */
HETPRY = 0x03;
HETGCR |= 0x00010003; /* Start HET */
__enable_interrupt();
for (;;)
{
}
}
__irq __arm void IRQ_Handler(void)
{
switch ((0xff & IRQIVEC) - 1)
{
case CIM_HET1: HETDOUT ^= 0x04; break;
}
}