Skip to content

Calculate DCRi using CTR0 #471

@crawfxrd

Description

@crawfxrd

The PWMi Duty Cycle output = (DCRi)/(CTR+1)
If the DCRi value > CTR value, PWMi signal is still low.
If DCRi value = CTR value, PWMi signal is still high.

Use Cycle Time Register to determine the PWM value that should be used for DCRi.

#define PWM_DUTY(X) ((uint8_t)(((((uint16_t)(X)) * 255) + 99) / 100))

255 (0xFF) here should be CTR0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions