I'm trying to use the hardware PWM on a PIC16F18313 but I get the following errors when compiling. The PIC has 2 PWM modules, and 2 CCP modules. The error below is from the attached code which is trying to use PWM5 and PWM6:
pwm.h (673): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (675): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (682): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (684): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (691): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (693): Error: Incorrect parameters in Set, expected: Set variable.bit status system.h (1533): Error: Incorrect parameters in Set, expected: Set variable.bit status system.h (1535): Error: Incorrect parameters in Set, expected: Set variable.bit status
(This is with 0.95.010_RC4 but I get the same error in the previous release but with different line numbers)
If I change HPWM 5, 40, Bright, 2 to HPWM 1, 40, Bright I get the following, similar error:
HPWM 5, 40, Bright, 2
HPWM 1, 40, Bright
pwm.h (290): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (292): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (299): Error: Incorrect parameters in Set, expected: Set variable.bit status pwm.h (301): Error: Incorrect parameters in Set, expected: Set variable.bit status system.h (1533): Error: Incorrect parameters in Set, expected: Set variable.bit status system.h (1535): Error: Incorrect parameters in Set, expected: Set variable.bit status
Where have I gone wrong?
I've solved this one myself...
The problem was the line: Set Status On which turns a status LED on. If I changed the variable Status to something else it compiles fine.
Set Status On
Status
Without the HPWM lines, using Status as a variable was OK :)
I can get CCP1 and CCP2 to work, but I can't get PWM5 or PWM6 to work. The help suggests that these are supported by GCB.
I'm trying the following:
;Chip Settings #chip 16F18313,32 #config FEXTOSC_OFF 'Direct the CCP/PWM to the output pins. UNLOCKPPS RA2PPS = 0x4 'PWM5 > RA.2 RA4PPS = 0xC 'CCP1 > RA.4 RA5PPS = 0xD 'CCP2 > RA.5 LOCKPPS For Bright = 1 to 255 HPWM 5, 64, Bright, 2 wait 4 ms Next
HPWM 1, 64, Bright and HPWM 2, 64, Bright (for CCP1 and CCP2) work OK, but I don't get any output on RA.2 with the above code.
HPWM 1, 64, Bright
HPWM 2, 64, Bright
I've tried the following without success: HPWM 5, 64, Bright HPWM 6, 64, Bright HPWM 6, 64, Bright, 2 HPWM 3, 64, Bright HPWM 3, 64, Bright, 2 RA2PPS = 0x5 'PWM6 > RA.2 RA4PPS = 0x4 'PWM6 > RA.4
HPWM 5, 64, Bright
HPWM 6, 64, Bright
HPWM 6, 64, Bright, 2
HPWM 3, 64, Bright
HPWM 3, 64, Bright, 2
RA2PPS = 0x5 'PWM6 > RA.2
RA4PPS = 0x4 'PWM6 > RA.4
Is there an example of using the PWM5/PWM6 modules?
Examples yes. Look in the Vendor/Xpress Board
Thanks, that sorted it. I had the PPS assignment incorrect!
Log in to post a comment.
I'm trying to use the hardware PWM on a PIC16F18313 but I get the following errors when compiling.
The PIC has 2 PWM modules, and 2 CCP modules. The error below is from the attached code which is trying to use PWM5 and PWM6:
(This is with 0.95.010_RC4 but I get the same error in the previous release but with different line numbers)
If I change
HPWM 5, 40, Bright, 2
toHPWM 1, 40, Bright
I get the following, similar error:Where have I gone wrong?
Last edit: Peter 2016-10-19
I've solved this one myself...
The problem was the line:
Set Status On
which turns a status LED on.If I changed the variable
Status
to something else it compiles fine.Without the HPWM lines, using
Status
as a variable was OK :)I can get CCP1 and CCP2 to work, but I can't get PWM5 or PWM6 to work. The help suggests that these are supported by GCB.
I'm trying the following:
HPWM 1, 64, Bright
andHPWM 2, 64, Bright
(for CCP1 and CCP2) work OK, but I don't get any output on RA.2 with the above code.I've tried the following without success:
HPWM 5, 64, Bright
HPWM 6, 64, Bright
HPWM 6, 64, Bright, 2
HPWM 3, 64, Bright
HPWM 3, 64, Bright, 2
RA2PPS = 0x5 'PWM6 > RA.2
RA4PPS = 0x4 'PWM6 > RA.4
Is there an example of using the PWM5/PWM6 modules?
Examples yes. Look in the Vendor/Xpress Board
Thanks, that sorted it.
I had the PPS assignment incorrect!