CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed Apr 24, 2019 7:00 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: PWM To analog
PostPosted: Thu Jun 14, 2018 3:56 pm 
Offline
Frequent User
Frequent User

Joined: Sun Apr 15, 2007 1:18 am
Posts: 155
Hello,

Has anyone ever written a program to convert PWM pulses to analog value?
If yes can you explain to me the principle.
I looked at OSCAT, but I did not find !

Thank you in advance
Best regard


Top
   
 Post subject: Re: PWM To analog
PostPosted: Thu Jun 14, 2018 5:26 pm 
Offline

Joined: Thu Jul 09, 2015 9:55 pm
Posts: 27
You have a constant frequency usually, then you know the total time between first rising edge to second rising edge:

T = 1/f.

Period can also be calculated and averaged in software if frequency is not known.

Then you check the length of the on-pulse and then for example get the percentage on-time from total periode-time.

Or even easier, use a first or second order low-pass filter and get an analog voltage.


Top
   
 Post subject: Re: PWM To analog
PostPosted: Fri Jun 15, 2018 11:16 am 
Offline
Frequent User
Frequent User

Joined: Sun Apr 15, 2007 1:18 am
Posts: 155
Thanks a lot somlioy , I'll try this soon. :D


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited