Author Topic: SETPWM behaviour between 2 FMD88-10  (Read 15959 times)

Philippe Parmentier

  • Newbie
  • Posts: 29
  • new in plc
    • View Profile
SETPWM behaviour between 2 FMD88-10
« on: March 26, 2014, 10:16:35 AM »
Greetings,

I've created a small ladder rung that run a Dcust function to set the followings commands:

SETPWM 1,500, 1
SETPWM 2,500, 2

On a FMD88-10 r81, it's working well generating a 2Hz pulse.

On a FMD88-10 t78, it' setting the DO7 and DO8 permanent.

Can you explain me that behaviour difference.

regards

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:SETPWM behaviour between 2 FMD88-10
« Reply #1 on: March 26, 2014, 08:48:36 PM »
The manual states that the PWM on the FMD PLC frequency is from 50Hz to 50KHz. This has been the case for previous FMD PLC.

However, from firmware r79 onwards the PWM now support down to 1Hz. That is the reason for the differences.

Typically PWM application are not meant to run at such slow frequency but it was added to support some special applications.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Philippe Parmentier

  • Newbie
  • Posts: 29
  • new in plc
    • View Profile
Re:SETPWM behaviour between 2 FMD88-10
« Reply #2 on: March 27, 2014, 01:23:13 AM »
Thanks for the reply... I wass in an hurry to buy the first PLC.... I should have been more patient!! (R78B) Lol

The Id behind was to use the second PLC to generate a Wind vane signal where the range is 5 to 500Hz.

I'm currently using a 0.01s coil and a counter but I reach 100Hz max

I tried with the INTDEF 18, but the problem is that I can put only one function linked, or I got 2 output with differents frequency to  play with.

On my old version, the PWM can then be any frequency between 50 and 50000 Hz?

Or is there another way to reach that goal?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:SETPWM behaviour between 2 FMD88-10
« Reply #3 on: March 27, 2014, 08:48:59 AM »
Since your output is very low frequency you can use the periodic interrupt to generate an interrupt every 10ms and use it as a time base to create slow PWM using TBASIC. You will need two variables for each output, one to keep track of the ON cycles and the other to keep track of the OFF cycles. So every time the periodic interrupt occur you increment the on cycle counter and when it reaches the desired value you will turn OFF the output and clear the on cycle counter to zero, then start incrementing the off cycle counter until the off cycle limit is reached, then then on the output and clear the off cycle counter and repeat the sequence. This way you can create more than one slow PWM.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Philippe Parmentier

  • Newbie
  • Posts: 29
  • new in plc
    • View Profile
Re:SETPWM behaviour between 2 FMD88-10
« Reply #4 on: March 27, 2014, 09:39:32 AM »
I've tried that already but with that system I can generate up to 100Hz frequency, or I need to go from 1 to 500 Hz

So I'm buzy to set a system that use 0.01sec interrupt up to 50Hz then using the SETPWD for higher frequency.

But is there a way when getting back to freq lower of 50Hz to stop the PWN on the channel and going back to interrupt counting?

I was thinking that's easy for the PLC to be a variable pulse generator to simulate a wind profile and anemometer behaviour, but in fact it is not

« Last Edit: March 27, 2014, 10:19:24 AM by PhilippeP »

garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re:SETPWM behaviour between 2 FMD88-10
« Reply #5 on: March 27, 2014, 11:29:55 AM »
If you need  a frequency output from 5 to  500 Hz and the PLC's PWM outputs can generate 50 to 50,000 Hz, is it possible to divide (scale) the PWM outputs by 10?

This would get you 5..5000Hz.  If you divided by 100 you'd get 0.5 to 500 Hz.

The old CD4017 chip is a typical solution for dividing a signal by 10. The CD4017 is still available. You could chain two of these chips to get a divide by 100.

This CD4017 can operate on 5 to 15 volts, but can not tolerate the 0..24 PLC output without some additional components.  If your PLC was operating on 12V you could run the CD4017 on the same supply as the PLC and connect it directly to the PLC outputs.

Gary d
« Last Edit: March 27, 2014, 11:31:10 AM by garysdickinson »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:SETPWM behaviour between 2 FMD88-10
« Reply #6 on: March 28, 2014, 01:07:13 PM »

But is there a way when getting back to freq lower of 50Hz to stop the PWN on the channel and going back to interrupt counting?

I was thinking that's easy for the PLC to be a variable pulse generator to simulate a wind profile and anemometer behaviour, but in fact it is not



When the frequency goes below 50Hz you basically turn the PWM output into ordinary output by setting it to either 100% (Fully ON) or 0% (full OFF)  and use the PTI method to generate the output.

Your board with r81 firmware should be much easier for this application since you can generate 1 Hz to 50KHz.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS