PPG bean with M52235EVB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PPG bean with M52235EVB

Jump to solution
2,320 Views
Steamy
Contributor II

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?

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,983 Views
Steamy
Contributor II

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

View solution in original post

0 Kudos
6 Replies
1,983 Views
ProcessorExpert
Senior Contributor III

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

0 Kudos
1,983 Views
Steamy
Contributor II
Hello Jiri , thank you very much for this info what I wasn't aware. On the contrary, in the Help of PE there is an example (3) how to generate a period 255 times and in the OnEnd event the mode is changed. My task is to switch between different frequencies (set up afore in the Period List) and the number of the individual periods should be set up at the time a new period is selected. e.g. generate 10 times period1, then 3 times period2, 5 times period1 and so on Also the duty should be changeable. I'm looking forward to reading from you hb
0 Kudos
1,983 Views
ProcessorExpert
Senior Contributor III

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

0 Kudos
1,982 Views
Steamy
Contributor II

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

0 Kudos
1,982 Views
Steamy
Contributor II

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

0 Kudos
1,984 Views
Steamy
Contributor II

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

0 Kudos