A/B Analog Input Scaling

WhatThe

Member
Join Date
Nov 2003
Posts
16
I have an A/B PLC 5/40 and Analog Input Modules 1771-IFE/B...I read that the Data Format should be Two's Compliment Binary but must be BCD for Analog Outputs. If you let RSLogix AutoConfigure and add the ladder logic for the Block Transfers it sets the Raw Scaling between 0-16533 instead of 0-4095. I understand that 4095-BCD is 16533-Dec my question is scaling the Raw Values into Eng Units. I guess you would have to divide by 16533 instead of 4095. Also if I want to control an inlet valve off of level signal....what steps do I have to take to convert dec to BCD before sending value to A/O module.
 
You should simply insert the MIN and MAX engineering values that you want the module to convert to.
Example: sensor range 0..100 degr.C then set MIN=0 MAX=100
If you want 0.0..100.0 resolution then set MIN=0 MAX=1000 (1000 meaning "100.0")

Tip: For 4-20mA inputs I use the range 0-20mA. That enables you to test for broken wire/dead sensor (if the signal is less than 2mA for ex.) In that case an 0.0..100.0 degr.C. (4-20mA) sensor would require MIN=-250 (at 0mA) and MAX=1000 (at 20mA).

The 0-4095 default range comes from the 12-bit resolution of the analog AD converter.
 
That's what I would normally do, however the client wants raw values shipped to the HMI due to past problems with replacing inputs and not revising the scaling factors in the Analog Module's Configuration.
 
Here is another great tip:

Create a special Analog i/o setup screen in your HMI.
You can then put the max and min values right on the HMI (so you dont have to have RSLogix5 online to change the i/o analog ranges).
Remember to put a button on the HMI for "activating" the new values. The button shall fire a BTW to the analog card.

Anyhow, I use two,s complement binary for analog outputs. I dont know why someone would use BCD.
 
TOD and FRD are the "To Decimal" and "From Decimal" conversion functions in the PLC-5.

What I'm wondering though is about your application:

"the client wants raw values shipped to the HMI due to past problems with replacing inputs and not revising the scaling factors in the Analog Module's Configuration"


In my mind, you are doing scaling with the Analog module anyhow. I'd do what makes sense in the PLC, and document it so that they can re-scale in the HMI if they really need to. (They can scale in the HMI regardless of what you do in the PLC). Alternatively, you could give them access to some of the analog module configuration data at the HMI on some sort of "Maintenance" or "Calibration" screen.

Marc
 
This is an existing HMI and already setup for Raw Values from the PLC to be scaled at the HMI. I guess I was alittle confused regarding the 16533 that RSLogix AutoConfigured. If I want to scale some of the values in the PLC would I be correct in the following:
(Raw-RawMin/RawMax-RawMin)*EUMax-EUMin
My RawMax - 16533
My RawMin - 0
 
Last edited:
I guess that the same thing can be done in a thousand ways.

I think that what you are saying, is that you cannot touch the HMI (or are you saying that you cannot touch the raw values in the PLC ?)

But you should try to convince the HMI responsible person(s) that a special analog setup or calibration screen in the HMI is a good idea.

The HMI's that I know of have scaling between the "raw" PLC values and the "engineering" HMI values. So you shouldnt have to create your own formula. But then I dont know which HMI you do have.
 
I really appreciate all your help.....sorry that I'm not making myself clear.

The HMI is existing and we didn't expect to make any revisions to it.

The PLC program is being revised and I CAN NOT scale to Engineering Units in the Analog Module Block Transfer Configuration.

Therefore I need to scale the Raw A/I values in the PLC logic. I believe that in the CPT Block where I would normally divide by 4095 I now need to divide by 16533. Is this correct? OR am I missing something!
 
Change your radix to HEX. You will see what you expect to see. For scaling in a CPT block, I think you are correct to divide by 16533 (or 4095h).

Marc
 
You are kind of missing something. But you are close.

To do a BTR from a 1771-IFE module, you first need to do a BTW in order to configure the channel.

As part of the BTW, you must define the range. By defaul the range is 0-4095, but you've got to tell it something.

That "default" value is created when you use RSLogix to set up the BTW/BTR. If you do it manually, you need to populate the BTW data registers by hand.

If you want the BTR to return a range of 0-4095 in the BTR data words, you set the corresponding addresses in the BTW data words to 0 and 16533 (e.g., 4095HEX).

If you use "BCD Fromat" (default) for your input data, that "4095" range will be in BCD, and you will need to do a FRD (not a divide!) to convert it to something useful.

If you use "2's complement" scaling (again, just a bit in the BTW data that you control, and transparent to the HMI), that "4095" in the BTR registers will show up as "4095", and then you do a divide-by-4095 to scale it.

Marc Sinclair's point is that, by nature of the BTW, have to be doing some sort of scaling at the Module. The only question is do you want to scale for engineering units or not.

What Jesper is recommending is having an HMI screen that can access (with the PLC doing sanity checks and BCD conversions) to the BTW configuration data, so that "calibrating" or "scaling" can be done there.

If it's just done at the HMI, then if a new instrument is installed with a different range from the one it replaced, the client will have to edit the HMI tag database to change the scaling. This is philosophically no different than changing the scaling in the PLC, and just as unlikely to happen.
 
Allen is right (thanks for correcting my mis-statement):

Allen Nelson said:
If you use "BCD Format" (default) for your input data, that "4095" range will be in BCD, and you will need to do a FRD (not a divide!) to convert it to something useful.

If you use "2's complement" scaling (again, just a bit in the BTW data that you control, and transparent to the HMI), that "4095" in the BTR registers will show up as "4095", and then you do a divide-by-4095 to scale it.


Regardless of which data format you are using, I still think that it makes sense to scale right in the module itself since . . .

1. Your analog signal is converted by the IFE Module to a digital value.

and then

2. The digital value must be scaled/converted to Engineering Units (either by the module, the PLC, the HMI, or a combination of the three)

You can either:

Get the digital value in the PLC right, and "scale" in the HMI by "multiplying by one" (if they really needed to, your client could change this "one" anytime). In this case, you can use 2's complements (or you can FRD a BCD value), and set the min/max values right in the module config.

or

Set the digital value in the PLC to an arbitrary value (FRD if necessary), and scale this arbitrary value in the HMI.


In either case, you will be scaling in both the HMI and the PLC/module! I'd personally like to have the PLC correct.

As Jesper, Allen, and I have said in our previous posts, you can give access to the module configuration data at the HMI. Regardless of whether you, your company, or your client makes this "configuration screen", it is a good idea (and can certainly ease your client's worries).

That said, unless the client is replacing an input device with a device having a different specification, I'd be surprised if the configuration really ever needed to be changed. Can you give an example of what they changed to give their "past problems"?


Marc
 
Last edited:
After I left the computer to go home yesterday, I realised that it is NOT possible to do as WhatThe suggest: To simply use 16533 as the MAX value for a scaling formula.
BCDs and INTEGERs are totally different. From WhatThe's posts it seems that the HMI uses "normal" integers. You can use TOD and FRD to convert back and forth between BCD and integers, as msinclair suggest.
But why not use integers everywhere, also in the PLC and the analog cards ?
I see no particular reason to use BCD's anyhow.

And, a HMI that newer changes ? Ha ha ha ha ha ......
If you dont use the possibility to update the HMI as changes happens, then you are wasting on of the MAIN advantages of a software based HMI solution.
We used to make these good old lamps + pushbuttons + dials type HMIs.
They looked good, but were a nightmare to maintain. What a relief after we switched to a software HMI.
 
Clarification

I probably didn't explain my situation as clearly as I should have.
The HMI is existing and the PLC Program is being modified.

What I have is several 16 channel Analog Input Cards all are set to a Data Format of Two's Compliment.

The Raw Integer Value from the Analog Input BTR is copied/sent to the HMI and it is scaled into Engineering Units on that end.

I wanted to scale a couple of Analog Inputs in the PLC ladder logic. I expected to see min/max values in the BTW of 0-4095 but they are 0-16533.

My question was how to scale the Raw Values from the BTR. From reading your post I believe that it must be divided by 4095. Hopefully I'm getting there.......just taking me alittle longer.
 
I expected to see min/max values in the BTW of 0-4095 but they are 0-16533.

We need just a little more clarification.
Where do you see the max/min values ? In RSLogix5 online ? In your HMI ? (attach a screenshot, a picture says more than 1000 words)

What voltage/current range are the modules set up to (in RSLogix5 online) ?
(be aware that there are jumpers on the IFE card that need to be set)
When you get the value 16533, what signal level (volt or mA) is on the input ?

here are a few ideas that I can throw in:

Possible explanation 1. The max/min values in the BTW file is set to 0-4095, but the analog card is using 0-16533 from some previous setup. If so, use "accept edits" button to start a BTW to the analog card, so that the 0-4095 values are invoked.

Possible explanation 2. (I am not sure that it is important with this problem but I mention it anyhow): The difference between the "Two's complement binary" and "Signed magnitude binary" is when the signal has to convert to a negative value. Maybe the signal is negative (crossed wires) and the value 16533 would be -4095 if Signed magnitude binary was selected (just a wild guess).
 
I think that is right. My understanding is:

In the BTW configuration data, regardless of whether you choose BCD (default), or 2's complement, you will still enter your "Config" data in BCD.

The data from the BTR (from the module), can be supplied in BCD or in 2's complement. That is what you are really choosing with the 2's complement option. If you look at the BTR data, and have chosen 2's complement, you scale based on the value there. If you look at the BTR data, and have chosen BCD, then you need to FRD first, then scale based on that value.

As Jesper says though - a picture is worth a thousand words. If you can post where you are seeing your 16533's and what your BTR/BTW config screens look like, that would be helpful.

Marc
 

Similar Topics

Dear all Iam using three load cells connected in parallel to calibrate the weight of a product but in don't have a weighting module in my...
Replies
4
Views
3,462
Hello everyone, I have a plc 5 input card receiving an input from a conductivity Transmitter where 0ma=0 uhms and 20ma= 20,000 uhms The raw min...
Replies
8
Views
3,610
Hello everyone, I have a plc 5 input card receiving an input from a conductivity Transmitter where 0ma=0 uhms and 20ma= 20,000 uhms The raw min...
Replies
2
Views
1,827
Hello! I am new at PLC programming. I am using TM221CE16R PLC with TM3AI8 analog input module and SoMachine Basic v1.6. I am trying to scale...
Replies
8
Views
7,047
Hello, I have a Micrologix 1400 PLC and using RSLogix 500. Using a Multi Ranger Ultra Sonic Level Sensor and the input is moved to N7:11, then...
Replies
15
Views
3,860
Back
Top Bottom