Im not completely sure what you meant by "resolution of the PWM on the OpenPLC is 65535"
Q1 - 19200000 Hz / 65535 pwmRange / 50 Hz = 5,85 pwmClock ?
As I mentioned above, using 50hz in python works fine, getting full 180 rotation between 2,8 % and 11
Calculating the Duty cycle % for pulses needed should be fairly easy:
(0,5ms pulse / 20 ms cycle) * 100 = 2,5 %
(1,5ms pulse / 20 ms cycle) * 100 = 7,5 %
(2,5ms pulse / 20 ms cycle) * 100 = 12,5 %
I have tried to apply a few UINT variables range between 3 and 11 using SFB but did not work.
OpenPLC has 16 bit analog resolution in software, even though not all hardware boards support 16 bit analog outputs. The Raspberry Pi has a 10-bit PWM in hardware, so OpenPLC translates (multiplies) that to 16-bit internally so that the same code works on all supported platforms. If you need a 20ms PWM period, than 375 pwmClock is the right number for you. However, to control the duty cycle of this period, you will need to use a number from 0 to 65535, where 65535 is equal to 100% duty cycle. If you want a 2.5% duty cycle (0.5ms pulse) your UINT on %QW0 should be:
(65535*2.5)/100 = 1638.375
Since UINT only accept integers, you will have to round it down to 1638 and have some little error on it. As you can see, values between 3 and 11 on the PWM output will literally translate to zero on the output since OpenPLC works with a higher resolution than the Raspberry Pi hardware.
Q2 - Does it translate the duty cycle % or the time?
I think I kinda answered that one on my explanation for Q1. But just to make it clear, it is neither time or duty cycle. OpenPLC uses a 16-bit value for all analog inputs and outputs. That number linearly represents the power used on the output, be it a true voltage output, current output or PWM output. The nuances about what kind of output is used is left to the platform where OpenPLC is running.
Q3 - How do I input a decimal value?
You cannot put decimal (REAL) values on %QW0, as explained above.
Q4 - Im not sure how to trigger the pwm output, is the SFB method Im using in above shown picture correct?
All you have to do is write a value on the %QW0 variable. You can either initialize the variable with the value you want (as you did before), or use MOVE, ADD, SUB, MUL, etc, blocks to put the value you want in there during run time.
Q5 - Every time I configure hardware_layer.cpp and recompile hardware settings, the parameters goes away, so I configured hardware_layers/raspberrypi.cpp. Should that be fine?
That is the preferred file to modify if you want your changes to be permanent.