Name:
pwmduty
Syntax:

PWMDUTY pin,duty cycles

Pin - is a constant which specifies the i/o pin to use. Note that the pwmout pin is not always a default output pin.

Duty - is a variable/constant (0-1023) which sets the PWM duty cycle. (duty cycle is the mark or 'on time' )

Description:

Alter the duty cycle after a pwmout command has been issued. On some parts the pwmduty command can be used to alter the pwm duty cycle without resetting the internal timer (as occurs with a pwmout command). A pwmout command must be issued on the appropriate pin before this command will function. See the pwmout command for more details and restrictions.

Applies To:
All (except 08, 18, 18A, 20M, 28, 28A)
See Also:
Related Create:
Share:
Print:

Start and change a PWM signal

Enable a PWM signal and then change its duty rate

Code Example:
init:	pwmout C.2,150,100	; start pwm

main:	pwmduty C.2,150		; set pwm duty
	pause 1000		; pause 1 s
	pwmduty C.2,50		; set pwm duty
	pause 1000		; pause 1 s
	goto main		; loop back to start
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.

Comments

  • Login to leave a comment.