SLAA476B February 2011 – July 2019 BQ2040 , BQ2040 , BQ2060A , BQ2060A , BQ2063 , BQ2063 , BQ2083-V1P3 , BQ2083-V1P3 , BQ2084-V143 , BQ2084-V143 , BQ2084-V150 , BQ2084-V150 , BQ2085-V1P3 , BQ2085-V1P3 , BQ20Z40-R1 , BQ20Z40-R1 , BQ20Z70-V160 , BQ20Z70-V160 , BQ20Z80A-V110 , BQ20Z80A-V110 , BQ28400 , BQ28400 , BQ78PL114 , BQ78PL114 , BQ78PL116 , BQ78PL116 , LM5145 , LM5145 , MSP430F5500 , MSP430F5500 , MSP430F5501 , MSP430F5501 , MSP430F5502 , MSP430F5502 , MSP430F5503 , MSP430F5503 , MSP430F5504 , MSP430F5504 , MSP430F5505 , MSP430F5505 , MSP430F5506 , MSP430F5506 , MSP430F5507 , MSP430F5507 , MSP430F5508 , MSP430F5508 , MSP430F5509 , MSP430F5509 , MSP430F5510 , MSP430F5510 , TPS40057 , TPS40057 , TPS40170 , TPS40170
This function provides access to PWM output control. The timer within the MSP430F5510 is configured to output the PWM at a rate of 20 kHz and can independently adjust two outputs for controlling voltage and current to the DC/DC converter.
Function Definition
void PWM_Control (unsigned char batt_num, unsigned char pwm_channel, unsigned char on_off, unsigned int pwm_duty_period) {...}
Inputs
Name | Type | Description | Example Value |
---|---|---|---|
batt_num | unsigned char | Value that represents battery channel number | BATT_1, BATT_2 |
pwm_channel | unsigned char | Channel type to output PWM: voltage or current | CHANNEL_VOLTAGE, CHANNEL_CURRENT |
on_off | unsigned char | Set the PWM output to HIGH or LOW | PWM_ON, PWM_OFF |
pwm_duty_period | unsigned int | Configure the duty cycle of the PWM output | PWM_DUTY_0 (approximately 0%)... PWM_DUTY_100 (approximately 100%) |
Return
None
Example Function Call
To turn off PWM on battery 1 voltage channel:
PWM_Control(BATT_1, CHANNEL_VOLTAGE, PWM_OFF, PWM_DUTY_0);
To specify 10% duty cycle on battery 1 voltage channel:
PWM_Control(BATT_1, CHANNEL_VOLTAGE, PWM_ON, 0.1 * PWM_DUTY_100);
Where pwm_duty_period = 0.1 × PWM_DUTY_100.