Author Topic: Variable conversions  (Read 1890 times)

adam22ym

  • Newbie
  • *
  • Posts: 1
    • View Profile
Variable conversions
« on: December 08, 2013, 08:05:11 PM »
I have a Modbus coming in as a Celsius temp and I would like to convert it to a Fahrenheit. I have tried *1.8+32 in the ValueScaleFactor in several different methods without success (Using various DigitalPanelMeters). What am I missing? where can I do some of these conversions at for this and others? Thanks

ENA

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • ENA
Re: Variable conversions
« Reply #1 on: December 11, 2013, 03:40:02 AM »
Hi. I had similar question. If you have your DataSubscriber in celsius where you get your data (lets call it DS_temperature), click on it, go to properties panel, click on events and double click on DataChanged event. It should take you to a sub that handles change od subscriber data. I'm going to assume that result is going in basic label, BL_fahrenheit.

Code: [Select]
Private Sub DS_temperature_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DS_temperature.DataChanged
        BL_fahrenheit.Value = CInt(DS_temperature.Value)*1.8+32
    End Sub