I made this program for a heater control by% from 0to99% duty cycle with display .but when i set pwm frequncy 50Hz then a mesg
tel that pwm is to low. but when i set pwm 70 Hz its work ok
my cycle time is 4ms and crystal 1Mhz.plz help me to get 50HZ.
Wed Feb 27 2013, 16:02:49, download attachment heater2.ld
pwm(by Volhout)
For 50Hz PWM you need to change the crystal to 500kHz. LDmicro uses a fixed divider to clock the PWM.
Tue Mar 12 2013, 09:19:58
why 50Hz(by Volhout)
Typically PWM is used to create a DC voltage (it is a stand alone process, not synchronized with anything except the crystal). If you way to duty cycle control a 50Hz (mains voltage) load you will have to sync to the mains.
You will need 100Hz PWM though, since you will allways have to control the duty cycle in the positive AND negative half of the sine wave. I am not sure how to sync mains and PWM using the PWM module inside LDmicro.
An option for a very rough PWM could be to sense the mains zero crossover in a rung (you need a HW detector). Run the PLC at it's highest cycle time (e.i. 1 mSec) and create your own PWM with a counter.
The maximum you can achieve this way is 1mSec resolution (for 100Hz=10mSec) giving you a rough control of the power in the heater. But this may be enough.
Tue Mar 12 2013, 09:31:43
50Hz(by MURTAZA)
THANKS for volhout for reply and solve the problum .as u guide me .i solve the matter .THANKS AGAIN