| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

Programmable Pulse Generator (PPG)

Provided functions of PPG module:

- Ppg_Init()
- Ppg_StartSoftwareTrig()
- Ppg_StopSoftwareTrig()
- Ppg_SelGateLevel()
- Ppg_ConfigUpCnt0()
- Ppg_StartUpCnt0()
- Ppg_GetUpCnt0Status()
- Ppg_DisableTimerGen0StartTrig()
- Ppg_ConfigUpCnt1()
- Ppg_StartUpCnt1()
- Ppg_GetUpCnt1Status()
- Ppg_DisableTimerGen1StartTrig()
- Ppg_ConfigUpCnt2()
- Ppg_StartUpCnt2()
- Ppg_GetUpCnt2Status()
- Ppg_DisableTimerGen2StartTrig()
- Ppg_EnableInt()
- Ppg_DisableInt()
- Ppg_GetIntFlag()
- Ppg_ClrIntFlag()
- Ppg_SetLevelWidth()
- Ppg_InitIgbt()
- Ppg_EnableIgbtMode()
- Ppg_DisableIgbtMode()
- Ppg_IrqHandler()

How to use PPG module?

Ppg_Init() must be used for configuration of a PPG couple channel with a structure of the type stc_ppg_config_t. Three ways can trigger the PPG start:

- Triggered by software
- Triggered by up counter
- Triggered by GATE signal from MFT

A PPG interrupt can be enabled by the function Ppg_EnableInt(). This function can set callback function for each channel too.

With Ppg_SetLevelWidth() the PPG low/high level width is set to the value given in the parameter Ppg_SetLevelWidth::u8LowWidth and Ppg_SetLevelWidth::u8LowWidth. Ppg_GetUpCntxStatus() can get the operation status of up counter (x=0,1,2)

If use software to start PPG, calling Ppg_StartSoftwareTrig() will start PPG.

If use up counter to start PPG, initialize up counter with Ppg_ConfigUpCntx() with a structure of the type #stc_ppg_upcntx_config_t, start the up counter with Ppg_StartUpCntx() and if count value matchs with compare value, the according PPG channel will start.

If use GATE signal to trigger PPG, set the valid level with Ppg_SelGateLevel(), and if GATE signal from MFT becomes valid level, PPG will start.

With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.

With polling mode, user can use Ppg_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Ppg_ClrIntFlag().

When stopping the PPG, if PPG is triggered by software, use Ppg_StopSoftwareTrig() to stop PPG output, if PPG is triggered by up counter, use Ppg_DisableTimerGen0StartTrig to stop PPG output, if PPG is triggered by GATE, set the GATE signal to invalid level in the MFT module.

IGBT mode is also supported by PPG. Ppg_InitIgbt() must be used for configuration of IGBT mode with a structure of the type stc_ppg_igbt_config_t.

Ppg_EnableIgbtMode() is used to enable IGBT mode and Ppg_DisableIgbtMode() is used to disable IGBT mode.