Renesas Single-Chip Microcomputer M38C89T-ADF Bedienungsanleitung Seite 126

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 138
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 125
5-10
Rev.1.00 May 22 2012
REJ09B0566
4BUsage Examples
5.5 25BMulti-Function Timer Pulse Unit
5
5.5. Multi-Function Timer Pulse Unit
2
Figure 5-5 shows an example of MTU2
usage.
/* Peripheral driver function prototypes */
#include r_pdl_mtu.h
#include r_pdl_cgc.h
#include r_pdl_pfc.h
#include r_pdl_intc.h
/* PDL device-specific definitions */
#include r_pdl_definitions.h
void main(void)
{
/* Initialise the system clocks */
R_CPG_Set(18E6, 144E6, 36E6, PDL_CPG_CK_2, PDL_CPG_OUT_CK_01);
/* Set the CPUs Interrupt Priority Level to 0 */
R_INTC_Write(
PDL_INTC_REG_IPL,
0,
0
);
/* Select the B pins for TLCKA, TCLKB, TCLKC and TCLKD by setting bit TCLKS in register PFCR5 to 1 */
R_PFC_Modify(
5,
PDL_PFC_OR,
0x08
);
/* Configure channel 0 for dual-waveform (A and B) output */
R_MTU_Create(
0,
0,
PDL_MTU_CLK_PCLK_DIV_1 | PDL_MTU_CLEAR_CM_B,
PDL_MTU_A_OC_LOW_CM_INV | PDL_MTU_B_OC_HIGH_CM_INV,
0,
0,
200 - 1,
400 - 1,
0,
0,
0,
0,
PDL_NO_FUNC,
PDL_NO_FUNC,
PDL_NO_FUNC,
PDL_NO_FUNC,
PDL_NO_FUNC,
PDL_NO_FUNC,
0,
PDL_NO_FUNC,
PDL_NO_FUNC,
0
);
/* Read the status flags and resisters A and D for channel 0 */
R_MTU_Read(
0,
&Flags,
PDL_NA,
&General_A,
PDL_NA,
PDL_NA,
Seitenansicht 125
1 2 ... 121 122 123 124 125 126 127 128 129 130 131 ... 137 138

Kommentare zu diesen Handbüchern

Keine Kommentare