Menu

Read Real value

bouba
2014-07-18
2024-03-04
  • bouba

    bouba - 2014-07-18

    Hello everybody!

    I want to read Real value from my Siemens PLC.I extract byte buffer with DBREAD fonction and i transform it to Real values.I have not any idea about this.

    Thanks

    E=MC2

     

    Last edit: bouba 2014-07-18
  • Davide Nardella

    Davide Nardella - 2014-07-18
    static float GetRealAt(byte[] Buffer, int Pos)
    {
        int Value = GetDIntAt(Buffer, Pos);
        byte[] bytes = BitConverter.GetBytes(Value);
        return BitConverter.ToSingle(bytes, 0);
    }
    
     
  • Ato

    Ato - 2024-03-04

    for real value Pos=??,
    int Value = GetDIntAt(Buffer, Pos);
    Pos=?
    Thank You

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.