Hi,
is there a difference between
PIOC->PIO_PER = something
and
REG_PIOC_PER = something
Hi @SupArdu
Both are acceptable and reference the same register, however the form:
PIOC->PIO_PER = ...
...is usually preferred.
One reason is that it's slightly more flexible when accessing an array of registers, for example when iterating through a number of PWM channels:
for (uint8_t i = 0; i < PWMCH_NUM_NUMBER; i++) // Loop for each PWM channel (8 in total)
{
PWM->PWM_CH_NUM[i].PWM_CMR = PWM_CMR_CALG | PWM_CMR_CPRE_CLKA; // Enable dual slope PWM and set the clock source as CLKA
PWM->PWM_CH_NUM[i].PWM_CPRD = 2040; // Set the PWM frequency 2MHz/(2 * 2040) = 490Hz;
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.