hpwmoff_3 - Anobium/Great-Cow-BASIC-Help GitHub Wiki
Syntax:
HPWMOff ( channel, PWMHardware )
Command Availability:
Only available on Microchip PIC microcontrollers with PWM modules.
Explanation:
This command will disable the output of the PWM module on the Microchip PIC chip.
PWMHardware
is a Great Cow BASIC defined constant not a user
vaariable.
Example:
'This program will alter the brightness of an LED using
'hardware PWM.
'Select chip model and speed
#chip 16F18855, 32
'Generated by PIC PPS Tool for Great Cow Basic
'
'Template comment at the start of the config file
'
#startup InitPPS, 85
Sub InitPPS
'Module: PWM6
RA2PPS = 0x000E 'PWM6OUT > RA2
End Sub
'Template comment at the end of the config file
'Set the PWM pin to output mode
DIR PORTA.2 out
'Main code
For ForLoop = 1 to 4
'Turn up brightness over 2.5 seconds
For Bright = 1 to 255
HPWM 6, 40, Bright, 2
wait 10 ms
next
'Turn down brightness over 2.5 seconds
For Bright = 255 to 1
HPWM 6, 40, Bright, 2
wait 10 ms
next
next
HPWMOff 6, PWMHardware 'where PWMHardware is the defined constant or you can use TRUE