Treboux
Hello,
I'm new to programming, I don't understand how to use the OSCAT PWM_DC function block.
Does anyone have a program where block is used to see how this one works.
(if possible for easy to understand use)
Sorry for my English, I only speak French.

My only knowledge is limited to the siemens logo for now.

Thank you already for your answer
Reply 0 0
kingmatrix
openplc does not support oscat lib,Please use a commercial softplc such as CodeSys,There are two hours of free running time.
Reply 0 0
thiagoralves
OpenPLC does support OSCAT lib. There is a PDF attached to the lib that explains what each block does. Try reading that first to get an initial idea of how it works
Reply 0 0
kingmatrix
You can't use OSCAT library to import directly to openplc, you need to download the converted one from the forum, PWM_DC function block can be used, you need to pay attention to F and DC is REAL format. In addition, when using this library in the forum, antivirus software will alarm, so it is still recommended to use openplc on a computer without network!
Reply 0 0
Treboux
Thank you for your answers.
I actually uploaded the library on the chat.
I made a program that I put in simulation with the PWM_DC block with a BOOL output.
One REAL Frequency input(I imagine that the initial value entered corresponds to a value in Hz?)
And a second REAL DC input which, if I understand correctly, corresponds to the activation (0.5 = 50%)
Yet during the simulation there is no PWM signal on the BOOL outputDo you know what I did wrong?

Thank you very much again

Capture d’écran 2023-01-12 184623.png
Reply 0 0
kingmatrix
pwm_dc has a lot of dependencies function block, you have to copy together, otherwise it can not run, specifically which dependencies, you have to check that pdf description, there is a relatively lazy way is to directly open the control modules folder with openplc, and then call the pwm_dc function, you will be able to enjoy
Reply 0 0
Treboux
Wow, 
I did not understand that blocks could be dependent on other blocks.
I just noticed that it is write in the C language of the block.
Now it works very well!
Thanks a lot for your help
Reply 0 0
Anderson
Eu, estou com o mesmo problema, desculpe  não entendi ainda, quais são os blocos que precisa para executar e gerar o pwm?
Reply 0 0
thiagoralves
These blocks generate PWM in software, which most likely is not what you want. If you're using an Arduino compatible board, try using the PWM_CONTROLLER block to control the hardware PWM peripheral. Not all Arduino boards support this block yet, so it depends on the hardware you have.
Reply 2 0
Anderson
Desculpa minha falta de conhecimento, sou novo no ramo. Mas como devo configurar o bloco CTRL_PWM? por favor

Em sex, 12 de jan de 2024 14:38, OpenPLC Forum <noresponse@discussion.community> escreveu:
Reply 0 0
Praveen Venugopal
These blocks generate PWM in software, which most likely is not what you want. If you're using an Arduino compatible board, try using the PWM_CONTROLLER block to control the hardware PWM peripheral. Not all Arduino boards support this block yet, so it depends on the hardware you have.
My PWM block work when program uploaded directly from Editor.
But I get compilation error when trying to compile in runtime
Reply 0 0
Reply