I'm using PE with CW10.1 Eclipse. Want to generate a Pulse Output with varying frequencies. For this purpose I take the "PPG" bean.
Problem: the "OnEnd" event is not generated.
The Interrupt/Event is enabled, also Enable/Disable and SetRatioMode with the timing list.
? Is there another bean neccessary OR what hides/disables the "OnEnd" event generation?
Solved! Go to Solution.
Hi,
finally I found the solution by using "Device Initialization".
I write into the DTMR the value 0x1F
the DTRR is loaded with the required number of pulses until an interrupt will occur
the remaining DTIM registers are 0x00
Hello
The OnEnd() event of PPG component is not available, because the PWM device of this CPU does not support "Interrupt on
period" interrupt source.
Could you write more about your use case? What kind of signal do you need to generate? Why do you need the On-End event?
Best regards
Jiri Rezler
Processor Support Team
Hello
What period does have your signal? if it's not too small, it's possible to use TimerInt + BitIO compoments and generateoutput signal by software in OnInterrupt() event of TimerInt component. In this case, TimerInt component will be configured in "From list of value" and by SetPeriodMode() method will be set to the period of output signal. In TimerInt component, the event code would be like:
Events.c module
byte cnt = 1; /* Sw counter, output period = TimerInt period/100 */
byte Duty = 50; /* value of duty */
void TI1_OnInterrupt(void)
{
if (cnt >= duty) {
Bit1_SetVal(); /* set output by BitIO component */
} else {
Bit1_ClrVal(); /* clear output by BitIO component */
}
if (cnt > 100) {
cnt=1;
// duty = 20; /* here is possible change duty and output frequency in run time */
// SetPeriodMode(1);
} else {
cnt++;
}
}
Best Regards,
Jiri Rezler
Processor Support Team
Hello Jiri,
thxs for your solution. It should be good for the period time I'm using (currently >=100us; but it will be smaller in future apps).
--------
As the chip has the advanced PWM module, I intended to use it and it would be more precise, what is important in my app.
My idea now is:
1. use the PPG as the time generator and connect it to my hardware
2. feed the PPG output additionally into a Counter of the processor
3. that Counter is loaded with the number of pulses, which the current period time shall clock
4. the Counter interrupts at it's countdown
5. inside the ISR the new data can be loaded
Also an advantage would be less interrupts occuring, as the FEC and all UARTS have to be served.
????
I need your help in identifying that """Counter"""
Best Regards,
Steamy
Hello,
in searching the "Counter" I would use the DTIM0; in PE the EventCntr8.
It counts the input pulses.
??
What is still missing: the intterupt function.
As the EventCntr8 inside PE doesn't offer an ISR, I need to program it manually.
Help:
up to now I haven't got the intterupt working.
Thxs
Steamy
Hi,
finally I found the solution by using "Device Initialization".
I write into the DTMR the value 0x1F
the DTRR is loaded with the required number of pulses until an interrupt will occur
the remaining DTIM registers are 0x00