Author | Stef Mientki, Copyright © 2002..2022, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling, Rob Jansen |
Compiler | 2.5r6 |
Performs PWM operations on the PWM4 module (of enhanced midrange) This file is automatically included by pwm_hardware.jal when the target PIC has a PWM4 module.
- Modelled after the libraries for CCP modules
No dependency found
pwm4_set_dutycycle_ratio(word in ratio)
pwm4_on()
pwm4_set_dutycycle_percent(byte in percent)
pwm4_off()
var byte _pwm4dch_shadow = 0
8 MSbits of duty cycle
var byte _pwm4dcl_shadow = 0
2 LSbits (left aligned)
pwm4_set_dutycycle_ratio(word in ratio)
Purpose: Set duty cycle in the range 0..1023 PWM steps. Arguments: word - dutycycle ration in range 0..1023 Notes: - The duty cycle will be set to the specified ratio of the maximum value for the current PWM frequency and Fosc. The resolution is about 1 pro mille The number of available PWM steps can be lower than 1023 with high PWM frequencies or low Fosc values. pin_PWM4_direction should be set to output!
pwm4_on()
Purpose: Set PWM on Arguments: none Notes: - duty cycle is restored from shadow registers pin_PWM4_direction should be set to output
pwm4_set_dutycycle_percent(byte in percent)
Purpose: Set duty cycle as a percentage, allowing max 100 PWM steps. The duty cycle will be set to the specified percentage of the maximum for the current PWM frequency and Fosc. Arguments: byte - dutycycle as a percentage (allowed range: 0..100) Notes: - The number of available PWM steps can be lower than 100 with (very) high PWM frequencies and low Fosc. The steps may not all be equal. The lower the actual resolution the bigger the differences between steps may be. pin_PWM4_direction should be set to output!
pwm4_off()
Purpose: PWM mode off Arguments: none
_pwm4_set_dutycycle_highres(word in steps)
Purpose: Specify the duty cycle by number of PWM steps. The duty cycle is setting is determined by a 10-bits parameter, allowing a resolution of 1023 steps. The 'steps' argument is a (max) 10-bits absolute value for the duty cycle: * steps<1:0> are the 2 LSbits * steps<9:2> are the 8 MSbits Arguments: word - steps cycle (allowed range 0..1023) Notes: - This is a private procedure, not intended for general use. The caller is responsible to specify an acceptable value w.r.t. to the chosen PWM frequency.