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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
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
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