Renesas Single-Chip Microcomputer M38C89T-ADF Instrukcja Użytkownika Strona 98

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 138
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 97
Rev.1.00 May 22 2012
REJ09B0566
4-78
3BLibrary Reference
4
4.2.7 Multi Function Timer Pulse Unit R_CMT_Control
3) R_CMT_Control
Synopsis
Control CMT operation.
Prototype bool R_CMT_Control(
uint8_t data1 // Channel selection
uint16_t data2 // Configuration selection
void * data3
// Period, frequency or register data
);
Description
Modify the operation of a CMT channel.
[data1]
The channel number n (where n = 0, 1, 2 or 3).
[data2]
Configure the timer channel.
Counter stop / re-start
PDL_CMT_STOP or
PDL_CMT_START
Disable or re-enable the counter clock source.
Omit this option to leave the timer state unchanged.
Period or frequency calculation
PDL_CMT_PERIOD or
PDL_CMT_FREQUENCY or
PDL_CMT_CONSTANT
The parameter data3 will contain the new period, frequency or new
constant register (CMCOR) value.
Omit this option to leave the timing unchanged.
[data3]
The new period, frequency or register value. This will be ignored if a timing change is not requested.
Data use Parameter type
The timer period in seconds or float
The timer frequency in Hz or float
The value to be put in register CMCOR uint16_t
Return value
True if all parameters are valid and exclusive; otherwise false.
Category
Compare Match Timer
Reference
R_CMT_Create
Remarks
R_CMT_Create must be first be used to configure the channel.
Program example
/* PDL definitions */
#include r_pdl_cmt.h
/* PDL device-specific definitions */
#include r_pdl_definitions.h
void func(void)
{
/* Change channel 2 to 1ms period */
R_CMT_Control(
2,
PDL_PDL_CMT_PERIOD,
1E-3
);
}
Przeglądanie stron 97
1 2 ... 93 94 95 96 97 98 99 100 101 102 103 ... 137 138

Komentarze do niniejszej Instrukcji

Brak uwag