PWM Output

ronboom

Guest
R
Hi all! I do validation testing for new products. The environmental validation stuff (vibration, temperature, humidity, salt fog, etc) not software validation. We manufacture instrument panel electronics (gages, lightbars, LCD screens, etc) for the marine, snowmobile, and heavy truck industries. During testing I use a lot of PLCs -- mostly for turning things on and off at different times. I did take a beginner & advanced class at the local community college; however, we never did PWM I/O. I'd like to set up O:0/2 on my MicroLogix 1200 to generate a signal to simulate a tachometer input to our snowmobile gage. I'd like to keep the duty cycle constant at 15%. I'd like to sweep the frequency from 10 to 250 to 10Hz over 60 seconds (8Hz / second). That way I could see if the gages are responding correctly while in the chambers and on the vibration table. I use a PLC for turning the idiot lights on & off and have a separate sweep function generator to send the tach signal. Space is at a premium, so I'd like to use the PLC for everything. Could someone please send me a sample RS-Logix program? Maybe a short write up?

thx,
ron -- [email protected]
 
ronboom,

That's a very interesting idea you have, to use the outputs of a PLC to send a tach signal. However, I might be wrong but I think the micrologix 1200 has mechanical relay type outputs and I don't believe you can get the frequency out of them that you are looking for. Even if the contacts were capable of that frequency, I'm not sure if the plc would be capable of switching that often (maybe with immediate output instructions). You have my curiosity going though, and tomorrow I am going to see if I can scrounge up a micrologix 1200 and I'll monitor it with my O-scope to see what kind of frequency range I can get. It's been a while since I did anything with PWM, but from what I remember, this is not exactly it. From what I do remember, PWM uses a constant frequency and the width of each pulse is adjusted in order to change the average voltage of the signal. Any way, I'll let you know whatever I come up with.

Jorge

BTW, what series is the micrologix 1200?
 
Jorge, it is a 1762L24BXB. My understanding is that channels O:0/2 & O:0/3 can be configured as PWM outputs with a maximum frequency of 20kHz. There is a special PWM instruction that sets the frequency and duty cycle. I've never used this before and I'm not sure how to set it up. Here's what I got from the internet...

NOTE: The PWM function is only available when using the BXB models of the MicroLogix 1200 or 1500

Locate the Function Files under Controller in RSLOGIX 500 v4.50.00 or later and select the PWM tab, then select the [ + ] next to PWM:0 (See Below)

Enter the following parameters as the "Minimum Configuration" required for the
PWM to generate a waveform at the specified frequency.

PWM:0.OUT Select Destination Output for pulses : Output O:0/2 or O:0/3

PWM:0.OFS Output Frequency - Frequency of the PWM : 0 to 20,000 Hz

PWM:0.DC PWM Duty Cycle - Controls the output signal of the PWM : 1 to 1000

DC = 1000 100% Output ON (Constant no waveform)
DC = 0750 075% Output ON 025% Output OFF
DC = 0500 050% Output ON 050% Output OFF
DC = 0250 025% Output ON 075% Output OFF
DC = 0000 000% Output OFF (Constant no Waveform)

The following example will generate a waveform on Output O:0/2
at a frequency of 250Hz and a 50% Duty Cycle.

The following ladder logic will need to be entered into File #2

By toggling Bit B3/0 the PWM can be activated.

Note: Once activated the PWM will continue to generate a waveform until B3/0 is toggled OFF or the PWM:0/EH (Enable Hard Stop) bit has been activated.

The picture portions won't paste in and I can't do an attachment.

thx,
ron
 
ronboom-
You really should consider registering. This isn't a sales site so you won't get spammed to death if you register.

As for your application, you will have to do some calculating to get this to work. You can write to both the output pulse width value and the PWM frequency value from your PLC program. You can simply move (MOV) the required values into the PWM data structure.
If I remember right these tachs work by looking at a pulse from one the points (or electronic ignition equivalent) aand filters this to get an analog value. This pulse would be a fixed width and you would get more and more of them per second as the speed increases.
To do this you will need to vary both your pulse width (PWM:0.DC) AND output frequency (PWM:0.OF) as your speed comes up. The frequency part is pretty straight-forward. It is just the Hertz value you get out of your sweep generator. The pulse width needs to be calculated. You first need to decide what size the pulse need to be (how long in time is it on). Multiply this time by your PWM frequency and you should get your pulse width duty cycle.

Do a search in the RSLogix500 help section for PWM. It give a pretty good idea of the bits you need to turn on to get this to work.

Have fun.
Keith
 
Kamenges,

You are correct, that's basically how the tach signal works on a vehicle. I believe the snowmobiles give 2 pulses per revolution, but don't quote me on that. We take that signal and manipulate it (with some electronic & software filtering) to calculate the RPMs.

So, I can write to the 0:OFS? I simply use a MOV instruction to do this? I've tried that using the C5:0.ACC word, but it won't let me. I may not have done the configuration correctly. I'll try again tonight.

thx,
ron
 
Ron-
Yes, you SHOULD be able to write to the configuration values of the PWM function using the MOV command. Just make sure that you use the full structure path when you do it (PWM:0.OF for output frequency, for example).
Let us know if this works.

Keith
 
Keith,

I wrote the program and I think it's working. However, I get nothing on the output when trying to measure frequency & duty cycle with a Fluke 87 series DMM. I can see the LED on O:0/2 blinking. I connected DC ground to COM2 and placed a 1K ohm resitor on O:0/2 pulled-up to 24V. I'd like to send you the program for your review, if you could provide me with an e-mail address. My e-mail is: [email protected]

ty,
ron
 
ron-
If you register you will be able top post youre code here on the forum. That will give others a chance to look at it and help you out also.

If you have the LED blinking you probably have the program somewhere close to right. It sounds to me like your wiring might be the issue. You need to provide DC power to the VDC2 terminal to provide power for your transistors. This DC power should be the mate to the DC common you talk about on COM2. Also, the output point doesn't need to be pulled up.

Give that a shot and see how you come out.

Keith
 
Keith,

OK, I registered. This is better, thanks. File is attached. Go easy on me, I don't do this for a living -- just makes my life a heck of a lot easier. I pulled the output up because the manual says that Max Load = 100mA & Min Load = 10mA. My 1K pull-up should put me at ~24mA. I did check with a scope and I'm getting nothing. The electrical is connected as you suggest -- only with a pull-up (I did try it without the pull-up and got the same thing). I can send a simple drawing if you want to see it.
 
ron-
I took a quick look at your program. It looks like you should be getting something out of the PWM output. So let's see if we can separate things a bit.
Start up your PWM (set the Run Bit). Then look at the status of the PWM function under 'Function Files' in the project tree. With the rung containing the PWM instruction active you should see the RS, NS and ES bits set. You should also see that OF equals OFS and DC equals DCS. If all this is true the software is doing what it is supposed to and we move on to hardware. If it doesn't show up like this, post what you see and we will go from there.
I also suggest that instead of pulling up the output (O:0/2) that you connect your resistor between the output and common. This will get your load up over the 10 mA minimum listed in the manual. Based on your model number the output transistor should be in a sourcing configuration.
After you get some basic response we will work on a couple of points in your program. You're pretty close, though. A very good start.

I hope this helps.
KEith
 
I've been humbled again -- and it's only Wednesday. I was finally able to get the actual manual from the AB website this morning to get a wiring example. I never connected the COM to GND -- wired it like it was a relay output. Amazingly enough, it works now. I would like any programming pointers you'd like to offer. The T4:0 description is wrong -- should be 8 Hz per second, just like I was expecting in my original thread. I was playing around with it and originally set it up for 1Hz per second by setting the timer's preset to 1000, I just forgot to change the description when I changed the preset. Anyhow, I appreciate all of the help and feedback! I'll keep checking back to see if there are any programming pointers -- I'm always looking to learn more!
 
ron-
Nicely done.
The only comment I would make is that you seem to be running a fixed duty cycle. This may not correctly emulate a tach pulse from an engine as the pulse width will decrease with frequency.
I guess I'm not exactly sure how the automotive tachs work. Maybe you do want a fixed duty cycle.
If you need to vary your duty cyle you can get this by multiplying your pulse width in seconds times your output frequency times 1000 to get the correct scaling for the duty cycle variable. If you do this just remember that your pulse width value will limit your maximum frequency. For example, a 10 millisecond pulse width limits you to 100 Hz before the duty cycle goes to 100% (0.010 * 100 * 1000 = 1000).

Good luck.
Keith
 
Keith,

Thanks for the advice. Sounds like a good idea. I'll try to get actual waveforms from Engineering to see what the duty cycle variation is. I intend to use this for snowmobile testing -- not automotive. I'm just using the PLC to drive a different FET that will be connected to ~35V. Some of the snowmobiles don't have batteries -- so faster RPMs = higher volts. I would imagine the duty cycle changes quite a bit as well.

I'm attaching the program again. I fixed the T4:0 description and added a rung to set everything back to original values when not in 'Run' mode.
 
AB RSLogix500 Manual - PWM

Hi,

I was wondering if you can post the software manual with the PWM instructions. I found a SLC 500 Instruction Set manual, but it has nothing about PWM. Can you help me out?

Thanks

CL

Keith,

Thanks for the advice. Sounds like a good idea. I'll try to get actual waveforms from Engineering to see what the duty cycle variation is. I intend to use this for snowmobile testing -- not automotive. I'm just using the PLC to drive a different FET that will be connected to ~35V. Some of the snowmobiles don't have batteries -- so faster RPMs = higher volts. I would imagine the duty cycle changes quite a bit as well.

I'm attaching the program again. I fixed the T4:0 description and added a rung to set everything back to original values when not in 'Run' mode.
 
The reference manuals for the various MicroLogix controllers include sections about the PWM instructions, since those are unique to MicroLogix. These are equivalent to the popular Instruction Set Reference manual for the modular SLC-500 controllers.

For example, the popular MicroLogix 1100 controller's User Manual describes the PWM and PTO instructions in Chapter 6 of the Reference Manual, Publication 1763-RM001.

http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1763-rm001_-en-p.pdf
 

Similar Topics

I have a project to control the speed of motor DC using PWM Output on PLC and when im on working i have a several trouble and of of them is the...
Replies
6
Views
202
Hi guys, i have never had to do a PWM Output or input before i have a Device that to dimm the lamp output from the ballast, the ballast has a 24V...
Replies
6
Views
1,039
Hello Friends, I am looking for a way to take my PID Output( it is the result of my PI Algorithm in Real format) and generate a PWM Signal in...
Replies
16
Views
2,491
Hi all, this is my first post and appreciate your advise in advance. I have a job to migrate a system form Mitsubishi FX5U to AB...
Replies
2
Views
837
The 1756-OB16IEF is a fast switching 12-24VDC output card. I'm doing a project where I need to control a stepper motor using 5V PWM signal. I'm...
Replies
1
Views
1,742
Back
Top Bottom