Yes a C Program is required.
See the SpindlePWM.c and SpindlePWMoff.c examples
Since you are using PWM #2 instead of #0 and each PWM has 2 control registers add 2x2=4 to the FPGA Addresses like this:
You might also read this Thread. Although it relates to Mach3 the technique is the similar.Code:FPGA(IO_PWMS+2*2+1) = 1; // enable the PWM FPGA(IO_PWMS+2*2) = pwm; // set the PWM