Hi,
My program requires me to delay a code without affecting the other codes in the for loop, maybe an interrupt?
Are there any ways to implement this?
Best Regards,
Marcus
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
My program requires me to delay a code without affecting the other codes in the for loop, maybe an interrupt?
Are there any ways to implement this?
Best Regards,
Marcus
Hi Marcus,
You can use the function DELAY_US to insert a delay. This is interruptible code
Regards,
Veena
Hi Marcus,
Do you intentionally want to generate an interrupt during the function?
What I meant was the function DELAY_US does not gate any interrupts. While inside the function, if there is an interrupt triggered, it will branch to the corresponding ISR.
Regards,
Veena
Hi Veena,
I want to make the program such that:
Board A: Transmit data at 5 seconds, Receives at Board B Transmitting time
Board B: Transmit data at 1 second, Receives at Board A Transmitting time
However, when I used the DELAY_US function, the whole program for Board A is delayed for 5 seconds. Is there any way to overcome this problem?
Thanks,
Marcus
Hi Marcus,
Why don't you set up a timer / pwm interrupt configured at the required frequency and transmit data in the corresponding ISR?
Regards,
Veena
Hi Veena,
Would like to check with you,
__interrupt void epwm1_timer_isr(void)
{
EPwm1TimerIntCount++;
// Clear INT flag for this timer
EPwm1Regs.ETCLR.bit.INT = 1;
// Acknowledge this interrupt to receive more interrupts from group 3
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
}
Do I place my own program inside this interrupt sub routine?
Thanks,
Marcus
Hi Marcus,
Yes, you can place your code in the interrupt ISR. Please note that the ISR code is not interruptible. If the code you are adding in the ISR is large, it might gate other interrupts till it completes the ISR function.
Regards,
Veena