Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

plc analog voltage programming

Status
Not open for further replies.

robohand

Electrical
Jun 19, 2003
5
Needing analog voltage help. Just can’t seem to get a grip of what to do with what I have.

My background:
Self taught – no real schooling.
No analog background. Ten years using many plc’s but almost all in discrete functions in ladder logic. Plc’s from A-B, Siemans, Modicon, Symax, Keyence, Koyo etc.. Robots from KUKA, ABB, Kawasaki, Fanuc etc..
I have done some moves, block transfers, fifo etc. type functions but not much.
I have used the Koyo plc and touch panel on other systems. I have no problems with programming these.

What I have:
Koyo (DL-205) 9 slot base with a DL-240 cpu.
Slot 0 to 2 ---- 32 point input modules – D2-32 ND3
Slot 3 to 5 ---- 32 point output modules – D2-32TD1
Slot 6 ---- Analog voltage input module – F2-04AD-2 (set-up for +- 5v)
Slot 7 ---- Analog voltage input module – F2-04AD-2 (set-up for +- 10v)
10” touch panel ---------------------------------- EZ-S8C-F

Keyence LS-7000 series digital micrometer (+- 10v analog output)
Keyence LK-031 laser displacement sensor (+- 5v analog output)

What is required:
Display of actual digital readings of the (2) Keyence devices on the touch panel.
The micrometer measures the diameter of the part which has a +/- 5 micron range. A good part measures 17.90245 to 17.90255 mm with a given analog value of 3239 to 3240. All I am looking to see it 17.902 on the touch display.
The displacement sensor measures 2 locations and the plc does an (A-B) function to output a good/bad part result. The overall measurement will be within 30 microns having 1.64 mm as a good part.

What I have been able to do:
Read the analog value and use greater/less than program elements to show good/bad part results. This was done by measuring a good part and getting the good part analog value to use for the program control.

Problems I have had:
Understanding the analog conversions. I have the Koyo analog I/O module manual but don’t really understand what all I can do with the analog signal.

Questions:
Are the analog cards in the correct slots? As I see the addressing, they are.

Can I get the actual digital readouts from the analog values? What are the correct conversion formulas and how do I use them?

Can I use the analog output values to drive (2) different analog input devices, all powered by the same power supply? I hope to send the value to the analog input card and to a (Measurement Advantage) “miniLAB 1008 measurement device which will go to a USB port of a computer for data acquisition.

The micrometer shows 7 place values but I only get 4 places of analog in V-memory locations. I have used (LDD and OUTD) for 32 bit, etc. but still only see 4 place values.

Can you please help me with my frustrations. I have put in over 40 hours with no results yet. I understand that I have gotten in over my head and need someone to give me air.

Many thanks in advance!!!!!!

Thank you,
In dyer need - Steve
 
Replies continue below

Recommended for you


Some quick answers to questions; Yes, as long as analog cards fall on word boundrys, everything is great i.e. input module is preceded by 16point cards. Your using a DL240, so you have pointer or multiplexer methods available, good. Remember, this is a 12bit card (unipolar) positive signal or a 13bit card(bipolar). This means 12bits is 4096 counts and 13bits is 8192 counts. You have some serious problems with trying to read more precision than you have. Any, to scale a number, you use the line formula y=mx+b where m is slope or (gain) and b is y intercept or (zero). Think of the x as the number you have in memory now and the y as the number you want to see and solve the equation. Playing with ldd and outd won't change your precision. You simply can not generate all those digits from this card. Your card is set up to digitize your signal into numbers and your limited to 0 - 4095 or -4095 - 4095. You can display more digits; but, you can't increase your resolution beyond this.
You say you want to see 17.902 on display. 17902 is greater than 16384 which is 2^14. You need a 16 bit card to do this as simply as you would like.
 
Steve
This is an analog scaling math function I have used many times with different processors. I'm not familar with the DL205, but the logic should be the same. Let's take your digital mic, let's say it has a +/- 10 volt output that is equal to 0 to 25 mm. If the analog input card on the plc is a 13 bit card then this means that the analog input display in the plc will be -4095 thur 4095. This means that the input card can only distinguish 8192 different voltages from the mic. So if you take the 25 mm and divide it by 8192 then the smallest difference you can measure is .00305 mm.
 
If the digital mic could be scaled for 17.5 to 18.0 mm
then, total scale is 0.5mm. .5/8192=.00006104, which would give you the required resolution. Reducing the scale of the digital mic to 17.9-18.0 would give even greater accuracy.

Ken
 
Thank you, very much, skills - spuds - and admiralken for your help with this. Your help has gotten me a long way but still need a little more.

I am able to get things almost right.

The analog card that I have is a 12 bit (1 in 4096). Will getting a 13 bit (-4095 to 4095) bi-polar do what I need. I can't get a 16 bit for this.

At this time the micrometer setup is load the analog value (3242) - multiply by 1000 - divide by 4095 and I get the actual voltage which equals the reference in mm. EX. The measured value 17.91560 and the voltage is 7.91. I am still looking to get 7.915 if possible. I tried many things but can't use binary or hex with this processor. The over-all range I am working with for a good part is 17.495mm to 17.905 mm. The mic control has RS232C but this will go to a computer for data acquisition, so I can't use that. Is there some way that I can use these values and do another conversion. I tried several thingsbut I just can't get anything to work. I am not sure how to put the converson in the ladder logic.


The laser is a little different. The overall values I need for a good part is 1.625 mm to 1.675 mm. It gave me the capability of setting one point to 0 and then I move the laser to the next measurement position. The laser control moves the +/- 5v to work as 0 to 10v. I load the 0 value position and then move. I take the next result (1343) and multiply by 1000 - divide by 8091 to get the analog voltage which represents the distance. A part that measures 1.63 gives a voltage of 163 which is great, but ggain, I need 1.639.

Is there something I can do in the ladder to get a 4 place value. Will a 13 bit card help me whth this. I tried to use double uords but got no where with this again.

Thanks again,
robohand (steve)
 
The card you have is 13 bit if you have it set up for +-10v or +-5v it will digitize from -4095 to +4095. Remember the sign bit is there to use. You can use binary with this card. I saw you mention you couldn't, but you can. When you configure card load a 8 into the MSN most sign- nibble of the configeration word and it converts to binary. Remember that in +-10volt mode that the smallest detectable voltage change is 2.44mv and in +-5volt it's 1.22mv.

I wish I could help you but I'm not understanding exactly what it is you want to do. I will say that this hardware set will do it except maybe for the high res. you seem to want. I liked the suggestions made above to narrow your input measurement field thereby increasing the DV/Dmeasured. Let me know if you need more.
 
I'M intereseted in knowing what the application is. Could you share details about the part you are measuring?
Best regards, PLCSAVVY
 
Skills,

I know you are familiar with Koyo. The spec’s on this analog voltage input module F2-04AD-2 say it is a 12 bit with ranges of 0-5, 0-10, +/-5 and +/-10. The micrometer out put is +/- 10. The card is configured for 1 channel and +/- 10. If I knew what I was doing when I started I would have ordered the 13 bit 8 channel. I am using 2 of these cards. One for the mic and one for the laser which is configured for 1 channel +/- 5v which the laser puts out. Of course, 2 cards because all channels have to be configured the same.

The sign bit:
I am not sure how to use the sign bit other than if it is true condition you are on the negative side. Anything equal or greater than 8001 is a negative value. As this application is set up now (scale), every measurement taken is a positive value anyway. I expect this will have to change because the scale needs to be different.

Scale setup:
The mic scale, as it is, will not work for what I need. I need to change the scale to work using the values of 17.495 to 17.905 in measurement to be output in analog voltage, as a good part. Any value less or greater is a bad part. I haven’t been able to set this up in the ladder. Figuring out how to set up this scale in the ladder is my problem. If the scale was set correct I think the resolution or accuracy will be what is required. I wish I could display the measurement value but I expect the operators will only get idiot lights indicating a big part / correct part / small part. A displayed measurement value would be easier to calibrate the analog signal but this will just be done another way.
At this time I have a scale, which I don’t really understand, gives me the exact readout in voltage that is the actual measurement value. i.e. measurement is 17.90511 and analog is 790 ---- 1(790)511 What I need to work with in the ladder is the value of 7905 ----- 1(7905)11 ---------------- as it is, the scale could look at other values because the 17.00000 will always be the same for a good part. The value I could use is from 495 to 905 for a good part. 17.(495)00 and 17.(905)00 --- I just can’t seem to figure out how to do this in the ladder program. There must be a way to do this or what good is having an analog output from these devices.

I sure appreciate all the help you have given!! I hope some day, I will be able to repay you in some manner.
Thanks again,




plcsavvy,

This application is an inspection machine. I can’t say what the part is but it is steel and there are other things checked. The part is transferred to each station where the inspection test will take place. One inspection is vision which checks for missing holes and details. Another is using air to make sure the chamfer is correct by testing for air leaks. The next is looking at a specific measurement, using a laser for non contact, look at one location and set that value to 0 and then move to another and check the difference. This difference must be between 1.625mm and 1.675mm to be a good part. (1.65 +/- .025) The nest station is a digital mic which checks a diameter which has to hold 17.9 +/- .005 ------------- This is the reason for setting the scale up correct and getting the correct analog signal.
To start, the parts are put into a hopper and then, one at a time, the orientation is set and the parts are loaded to a transfer bar which conveys them down the line through the different inspections. At the end the parts are pulled from the line and using a linear slide, they are put into different locations, baskets, depending on the results of the tests.

 
Ok, my point is that if you have 0-4095 plus a sign bit then you have, of course, resolved to 1 in 8192. This is referred to in the manual for this card as 13 bit on page
3-3 in DL205 Analog I/O modules book in the Resolution section. On page 3-16 in same book, an example is given for using Bipolar ranges (multiplexing style) and page 3-17 using 2's complement for averaging bipolar signals. Page
3-12 explains the resolution of this module fairly easily. If you don't have this manual, it can be downloaded at and has scaling examples on page
3-18 that are easy to read, unfortunately, they don't use a bipolar signal. I'll look at your Keyence stuff and I may write a solution if I get time later today. I may not have a module here today, so it may be partially untested; but it shouldn't be hard to do once you read the pages I cited above.
 
I forgot to tell you how to use the sign bit. It's simple to turn the raw data into a number 0 - 8191. All I usually do is to write 2 seperate rungs that take the sign bit and switch only one on depending on the sign. If sign is cleared or positive data, then I take RAW and add 4192 ? I think and store it in SCALED_1ST. If sign is set, data is negative, I simply take RAW and store it to SCALED_1st. I hope this makes sense as it works well and is easy. I use 2 seperate rungs with one storing raw if negative. I use other rung to store raw + shifting offset if positive. Hey, analog processing is 1% electrical and 99% algebra. It's only fiddling with numbers to suit your needs. Are you sure that the analog outputs of your KEYENCE has more than 12 bits resolution, if not, were wasting time. I'll check back with you later!
 
I had an OOPs on my example that occurred to me later. For the negative signal rung, you must load 4095 and subtract the RAW and then store this result to SCALED_1ST. I'm sorry for the BOO-BOO. The above example would have made -10v convert to 4095 and then decreased to 0 as input apprached 0v. In any case, throw these two lines in and in should be close to where you want to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor