Menu

how to use readBits method

Help
2009-01-27
2013-05-09
  • Nobody/Anonymous

    Hi,

    I need a help. Is it possible to read only DBX0.someBitOrRangeOfBits with readBits method? In my project I need to read range of bits from DB10.DBX26.0 to DB10.DBX26.2. If possible how can I do this?

    Thanx,

    Jani

     
    • Primož

      Primož - 2009-01-27

      Hello Jani!

      I do things in Delphi like this!

      1.) First I create source file from DB I would like to read/write from/to in Simatic (DBXXX.awl)
      2.) With Delphi function I open this AWL file and read names of variables. I also calculate the address of variable depending on type of variable and on type of previous variable and it's address. Like this I have a record of variables with variable names,  types, and addresses of aperance in PLC.
      3.) With libnodave I constantly read (OnReadEvent) number of bytes (INT, REAL = 2B + 4B) that are used in DBXXX described above. Each time after the transfer is complete (interval) I transform bytes into suitable value (INT, REAL, BOOL...).
      4) I write to DB using standard methods of libnodave component!

      bye

       
    • Nobody/Anonymous

      Hi,

      Thank you for your answer. I still have problem. Can someone post some C# code on topic how to use readBits method.

      Thanx,

      Jani

       
    • Cpt. Spock

      Cpt. Spock - 2009-02-05

      Hi!

      I suggest to use daveReadBytes() and then use bit logic operators in C to isolate the wanted bits. With that method, you have only one read request to the PLC. I have used it for my first project, running under Linux / OpenSuSE 10.2.

      Live long and prosper!

      Cpt. Spock

       

Anonymous
Anonymous

Add attachments
Cancel