# \-10 to + 10 (volt) OPC Tag Scaling

**URL:** <https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056>\
**Category:** Ignition\
**Created:** [August 16, 2022, 3:54pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056 "2022-08-16T15:54:38Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Demorotski](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mike\_Demorotski](https://forum.inductiveautomation.com/u/Mike_Demorotski)\
**Post date:** [August 16, 2022, 3:54pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/1 "2022-08-16T15:54:38Z")

</div>

I’ve been wrestling with a scaling issue with an OPC tag (-10 to +10) volt analog output, and would appreciate some help.

I have a tag coming out of an Opto-22 device and I am running ignition version 8.0.16. Showing that I can get one extreme or the other to display correctly, but any value in the middle is wrong, is telling me that this is not a linear scale, and was looking for help with either python code examples or perhaps something I am missing directly with the OPC tag definition, I would appreciate a nudge on the proper direction.

Using Ignitions OPC Quick client I can collect counts/values of -1606 for -10 and 16672 for +10 volts.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/69544019ceffbae36bfbc45b11f544c784b4789e.png)

(and)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/42b84de18a0e242372736314ba7b11db7ffc32a5.png)

I then use these values to define the OPC tag as follows;

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2f64ccf877da4b28a154da446b04d50a863994e6.png)

In my code I can then have a numeric field display both extremes as follows, but anything in-between is not correct.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/c/4caa4b6b6462290840e40c2501a38ab526100a00.png)

…and + 10 volts

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/3/635aa38976858da731e10d2590821180c9bf003e.png)

But, 5.5 volts displays as 9.93 volts (etc, etc)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/61238a966f8d839185d64b9673a7a25e02192a1f.png)

All tag values are defined as floating, and changing from Linear to Square Root does not help… as mentioned I would appreciate some help!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 16, 2022, 4:12pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/2 "2022-08-16T16:12:25Z")

</div>

Can you post datasheet links for the devices in question?

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [August 16, 2022, 4:20pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/3 "2022-08-16T16:20:45Z")

</div>

You posted the raw values for -10V and 10V, but what raw value is being read when it shows 9.93V. Just want to make sure that just because you’re feeding it 5.5V doesn’t mean that equivalent raw value is coming through.

---

<div class="post-metadata">

**Author:** ![Mike\_Demorotski](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mike\_Demorotski](https://forum.inductiveautomation.com/u/Mike_Demorotski)\
**Post date:** [August 16, 2022, 4:57pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/4 "2022-08-16T16:57:58Z")

</div>

Thank you all for your responses,

I have attached a Datasheet for the Opto-22 DA7 (-10 to 10 volt) Analog output

[DA7\_0441\_Std\_Voltage\_Output\_data\_sheet.pdf](https://forum.inductiveautomation.com/uploads/short-url/2dEYUSN3OgSB1wIUgq4UvcgEMAj.pdf) (601.9 KB)

I’ve monitored the values/counts as I’ve changed voltage as well as placed a volt meter on the output to ensure that the volts that I request are actually being output…

Besides the -10 and 10 volt raw counts, I’ve documented the raw counts for the following voltages, with the first column being volts.

-1 = -16512  
-2 = -16384  
-3 = -16320  
-4 = 16256  
-5 = 16224

1 = 16225  
2 = 16384  
3 = 16447  
4 = 16511  
5 = 16543  
6 = 16576  
7 = 16607  
8 = 16639  
9 = 16655  
10 = 16672

And the OPC Quick Client for 5.5 volts is below;

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/86d09e985d5ab574b9c9b42031203552da4255fe.png)

Which shows 5 volts being 16543 raw counts and 5.5 being 16559 for a difference of 16 counts, yet still below 6 volts (16576).

Again thank you for your help…

---

<div class="post-metadata">

**Author:** ![Mike\_Demorotski](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mike\_Demorotski](https://forum.inductiveautomation.com/u/Mike_Demorotski)\
**Post date:** [August 16, 2022, 5:07pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/5 "2022-08-16T17:07:08Z")

</div>

My mistake for the -4 and -5 volts the counts should be NEGATIVE or -4 volts = -16256 and -5 volts should be -16224

I apologize for the confusion

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 16, 2022, 5:13pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/6 "2022-08-16T17:13:28Z")

</div>

It looks something like a Modbus byte-order problem to me. Can you reverse the byte-order? I’ve tried it in a spreadsheet but can’t see a pattern.  
The datasheet says the modules are 12-bit ADC so max positive would be 2047(0x07FF) and max negative would be -2048 (0xF800).

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 16, 2022, 5:54pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/7 "2022-08-16T17:54:01Z")

</div>

I think @Transistor is on the right path.

I question whether you should even have this addressed as floating point or if you should just be reading a 16-bit register and then applying scaling.

What does your Modbus address mapping look like?

edit: oops, based on your screenshot you probably don’t have it configured as a float in the address mapping, but it would still be useful to see.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 16, 2022, 5:56pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/8 "2022-08-16T17:56:14Z")

</div>

> [@Kevin.Herron](#):
>
> I question whether you should even have this addressed as floating point ...

Oooh, that could do it. I missed that!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 16, 2022, 5:56pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/9 "2022-08-16T17:56:32Z")

</div>

Haha, I’m not sure now, need to see the mapping.

---

<div class="post-metadata">

**Author:** ![Mike\_Demorotski](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mike\_Demorotski](https://forum.inductiveautomation.com/u/Mike_Demorotski)\
**Post date:** [August 16, 2022, 6:37pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/10 "2022-08-16T18:37:10Z")

</div>

Good Points, ModBus is very confusing to me…

Below is the Ignition addressing, followed by a shot of ModScan64 (addressing) and value.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f2e435af436c35534d0f6d428a980f98fd72a133.png)

Modscan with the value of 5.5 volts being output

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0c720dc306683c1d758ef13dba709caf7f7d648c.png)

Both Ignition and ModScan is addressed to the IP address of the Opto-22 board containing the DA7 module.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 16, 2022, 6:40pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/11 "2022-08-16T18:40:27Z")

</div>

I don’t understand what I’m seeing in the Modscan screenshot. Is it saying the value is `1085269758`?

Are you in some kind of view that is showing you 32-bit values by combining adjacent registers?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 16, 2022, 6:43pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/12 "2022-08-16T18:43:38Z")

</div>

Okay, that value is `0x40AFE6FE`, which if you interpret is a 32-bit IEEE float is `5.49695`…

So maybe you don’t need any scaling at all, and you just need to change the Modbus Type in your mapping to be 32-bit float.

---

<div class="post-metadata">

**Author:** ![Mike\_Demorotski](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mike\_Demorotski](https://forum.inductiveautomation.com/u/Mike_Demorotski)\
**Post date:** [August 16, 2022, 7:01pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/13 "2022-08-16T19:01:33Z")

</div>

Changing views in Modscan to Floating Point ( most significant register first ) and I now see the value that is being output 5.4969 or my (approx) 5.5 volts

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/a/aa99bded493c30eadc933e6653dedbde376afd6d.png)

---

<div class="post-metadata">

**Author:** ![Mike\_Demorotski](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@Mike\_Demorotski](https://forum.inductiveautomation.com/u/Mike_Demorotski)\
**Post date:** [August 16, 2022, 7:28pm UTC](https://forum.inductiveautomation.com/t/10-to-10-volt-opc-tag-scaling/63056/14 "2022-08-16T19:28:50Z")

</div>

Holy cow guys, without you and your ideas I would still be working on this (night/day!!! I might add) and for this I **sincerely** want to thank you!

I changed the addressing on the Ignition side to floating point, and turned off scaling, and I’m displaying out to the screen/HMI the actual values, example follows;

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/9/49d3314a5639017281063ab2cd9259b5fee6e6e5.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/7/47c7188dcaf2eefba1650612caf814c506fa8d46.png)

Many many thanks!
