The PWM4
module provides functions to control and configure Pulse Width Modulation (PWM) on the PIC16F series microcontrollers. The module allows dynamic configuration of the PWM output pin, duty cycle, and enables/disables the PWM signal on a selected pin. It integrates with peripherals like the timer for accurate timing and signal generation.
File Information #
- Files:
pwm4.h
,pwm4.c
- Version: 1.0.1
Supported Processors: #
PWM4 Interface #
The PWM4
instance provides access to the PWM4 functions, allowing for initialization and control of the PWM signal on the selected pin.
Function Descriptions #
Initialize(GPIO_Ports_t PortPin, PWM_ConfigEnum_t PWM_Config)
- Description: Configures the selected GPIO pin for PWM4 output and sets the necessary parameters, such as the PWM mode (8-bit or 10-bit) and the associated timer (usually Timer2).
Output(LogicEnum_t setState)
- Description: Enables or disables the PWM4 output on the selected GPIO pin. This function can be used to toggle the PWM signal on or off.
DutyCycle(uint16_t dutyValue)
- Description: Adjusts the duty cycle of the PWM signal. The duty cycle controls the ratio of high-to-low time in each cycle. The value is set as a 10-bit value, where 0 represents a 0% duty cycle (always LOW) and the maximum value represents a 100% duty cycle (always HIGH).