BobB Posted September 25, 2014 Report Posted September 25, 2014 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. Quote
ECSI Posted September 25, 2014 Report Posted September 25, 2014 Set the four registers to: P1+3 = #0FA0 P1+2 = #0900 (Not #384) P1+1 = #0000 P = #0400 (Not #190) Quote
BITS N BYTES Posted September 26, 2014 Report Posted September 26, 2014 I gave up on SCL instructions a long time ago. Use APR [069] instead. Quote
BobB Posted September 26, 2014 Author Report Posted September 26, 2014 Tried the numbers suggested - they did not work either. Forgot about APR - have noit used it for years. Thanks. Quote
Mendon Systems Posted September 27, 2014 Report Posted September 27, 2014 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. Quote
ECSI Posted September 27, 2014 Report Posted September 27, 2014 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. Quote
BobB Posted September 27, 2014 Author Report Posted September 27, 2014 (edited) 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 September 27, 2014 by BobB Quote
banker Posted September 27, 2014 Report Posted September 27, 2014 ;) function block ;) http://forums.mrplc.com/index.php?app=downloads&showfile=996 Quote
chelton Posted September 28, 2014 Report Posted September 28, 2014 Not sure why your not getting the right scaled value? These values give the correct value. Quote
BobB Posted September 28, 2014 Author Report Posted September 28, 2014 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. Quote
BITS N BYTES Posted September 28, 2014 Report Posted September 28, 2014 (edited) 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 September 28, 2014 by BITS N BYTES Quote
Michael Walsh Posted September 29, 2014 Report Posted September 29, 2014 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. Quote
BobB Posted October 1, 2014 Author Report Posted October 1, 2014 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! Quote
Sleepy Wombat Posted October 13, 2014 Report Posted October 13, 2014 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.