Missing is the actual HPWM command itself. Check the Help file in the GCBasic folder, or online help from the web page. There is a perfectly good example in the command reference.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ah, thank you all. I needed to do both it seems. What threw me for a loop was I looked only at the PWMOn and PWMOff Help files. Here's what PWMOn States…
Syntax:
PWMOn
Explanation:
This command will enable the output of the PWM module on the PIC chip.
Example:
'This program will enable a 76 Khz PWM signal, with a duty cycle
'of 80%. It will emit the signal for 10 seconds, then stop.
#define PWM_Freq 76 'Set frequency in KHz
#define PWM_Duty 80 'Set duty cycle to 80 %
PWMOn 'Turn on the PWM
WAIT 10 s 'Wait 10 seconds
PWMOff 'Turn off the PWM
For more help, see:
PWMOff
No mention of HPWM there. Not very obvious (to me) only looking at that. Need to do more reading here on this end. Always learning.
Thanks again!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, it's probably me, but I can't get the Hardware PWM to work on a 16F690 Chip. I've tried several PICs. Here's my code…**
;Chip Settings
#chip 16F690,4
#config OSC=INTRC_OSC_CLKOUT
;Defines (Constants)
#define PWM_Freq 1
#define PWM_Duty 80
Wait 1 s
PWMOn
Set PortB.6 On
**
The chip does function because PortB.6 does come on. What am I missing? Thanks!
The PWM pin isn't automatically set up as an output pin so you might need to add -
Missing is the actual HPWM command itself. Check the Help file in the GCBasic folder, or online help from the web page. There is a perfectly good example in the command reference.
Ah, thank you all. I needed to do both it seems. What threw me for a loop was I looked only at the PWMOn and PWMOff Help files. Here's what PWMOn States…
Explanation:
This command will enable the output of the PWM module on the PIC chip.
Example:
'This program will enable a 76 Khz PWM signal, with a duty cycle
'of 80%. It will emit the signal for 10 seconds, then stop.
#define PWM_Freq 76 'Set frequency in KHz
#define PWM_Duty 80 'Set duty cycle to 80 %
PWMOn 'Turn on the PWM
WAIT 10 s 'Wait 10 seconds
PWMOff 'Turn off the PWM
For more help, see:
PWMOff
No mention of HPWM there. Not very obvious (to me) only looking at that. Need to do more reading here on this end. Always learning.
Thanks again!