Sign in to follow this  
Followers 0
BobB

Scaling - cannot get the correct result

14 posts in this topic

I normally do not scale things in PLCs and just use the raw analogue input numbers - usually there is a meter on the touch screen and scaling is done there. On this project I have to scale an input and show numbers on the screen and cannot get the scaling function to give me the right numbers - the meter is working correctly as per my method above. The analogue input is from a chemical dosing unit and 4-20ma represents a PH reading of 4-9. I have set up SCL with #190 (400) in the first register, #0000 in the seond register, #384 (900) in the third register and #FA0 (4000) in the fourth register. I think that is right but it is giving me a higher number than it should. changing the word type on the screen from UINT to BCD2 cofuses the issue even more. For example, with a binary value on the analogue input of 2230 I get a scaled result of 771 where it should be about 692. Any assistance appreciated.

Share this post


Link to post
Share on other sites
Set the four registers to: P1+3 = #0FA0 P1+2 = #0900 (Not #384) P1+1 = #0000 P = #0400 (Not #190)

Share this post


Link to post
Share on other sites
I gave up on SCL instructions a long time ago. Use APR [069] instead.

Share this post


Link to post
Share on other sites
Tried the numbers suggested - they did not work either. Forgot about APR - have noit used it for years. Thanks.

Share this post


Link to post
Share on other sites
I gave up on those functions a long time ago also. I generally add DM registers for tuning gain and offset then do the math in floating point.

Share this post


Link to post
Share on other sites
Geez...I always thought SCL was one of the easiest instructions to use. It's definitely easier than APR for a linear 4-20mA signal.

Share this post


Link to post
Share on other sites
Neither give me thew right numbers @#?$&* It is a 4-20ma analogue input from a chamical dosing controller. The FAC (chlorine) is 0-10 so I just div ide 4000 x 40 and get the right numbers. The PH is 4-9 so I tried SCL and got wrong number - same with APR - wrong numbers. The anaolgue output must be linear as when I use the input word directly into an anlogue meter in an NS15 and scale it the needle is perfect! Will post the code a little later. Edited by BobB

Share this post


Link to post
Share on other sites
;) function block ;) http://forums.mrplc.com/index.php?app=downloads&showfile=996

Share this post


Link to post
Share on other sites
Not sure why your not getting the right scaled value? These values give the correct value.

Share this post


Link to post
Share on other sites
I will have another go but I did try those figures too. May even try the function block - do not usually use them. Too hard for my customers to understand when trouble shooting and one customer when commissioning.

Share this post


Link to post
Share on other sites
Which model PLC and analog module are you using? What are the dip-switch settings for the module you are using? For 4-20mA inputs manual shows #1F40 NOT #0FA0 [in (brackets)]. Could this be your issue?CS Analogue IN.pdf #0FA0 = 4000 resolution #1F40 = 8000 resolution Edited by BITS N BYTES

Share this post


Link to post
Share on other sites
The reason that I don't like the SCL instruction is that it also converts to BCD. I rarely use BCD these days. I use the function block in the link above. Bob, be sure that you are monitoring in BCD and not as an integer if you are still trying to use the SCL instruction.

Share this post


Link to post
Share on other sites
Thanks all - have been working away and just back. The analogue card is 4000 resolution - I have not chaged it from straight out of the box - no need - do not need higher resolution. I will get back to the site next week and probably give the FB ago. Just means I cannot insert it in ruddy run mode - have to stop the PLC and download. That to me is a major PITA!

Share this post


Link to post
Share on other sites
Bob the SCL can work... I hate it but it works.. I prefer my FB I uploaded ages ago... however if you want to use the SCL then do the following... for EXAMPLE.. SCL D1 D10 D2 D1 = raw value in decimal (bin) D2 = scaled BCD number. for 0-4000 RAW scl to 0000-1400 D10 = #0000 D11 = &0000 D12 = #1400 D13 = &4000 (#0FA0) NOTICE the & and # numbers..... In your case you want the result to be #400 to #900 BCD scaled answer.. therefore D10 = #0400 D11 = &0000 D12 = #0900 D13 = &4000 THIS works... The result is in BCD. if you want Decimal for display and easy comparison use the BIN instruction after the scale function on the D2 result... If still showing the wrong RESULT I would suggest you look at how you are monitoring the values.. ie look at your tool bar with the glasses with numbers of 10, +/-10, 16. If you are monitoring in decimal then a result of #0900 BCD for 4000 raw will display as &2304 which of course will look wrong..... Remember the SCALE function result is in BCD then use BIN on &2304 and the result will be &0900 On my next Invoice...
1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0