I am trying to access items in a TPLCStruct as follows:
myStr_Spd: TPLCStructItem; //which is an element of Mystruct:TPLCStruct, without a protocol driver attached
temp:double;
movespeed:integer=300;
....
myStr_Spd.Value:=move_speed;
temp:=myStr_spd.Value; // temp <> move_speed ??? This puzzles me
The IDE Autocomplete suggests: myStr_Spd.SetValue(move_speed) but the compiler does not allow this (no Member SetValue). With an HMIEditBox, I can change the value, which I did for testing, but now I'd like to assign values to the tags via a procedure...
So: Why can I assign a value, but get something else in return? What am I doing wrong?
How should I assign a value to a PLCStructItem type tag? The items in the structure are not all of the same tagtype. Do I have to make a TArrayOfDouble, set the values for the elements, and then write the whole array to Mystruct?
Is it correct that in "PLCBlock1.Write(cmd,2,3) \" the "3" refers to the element of the Block with index 3 where the writing of the dynamic array's contents begins?
Michael
Last edit: michael hompus 2015-06-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Fabio,
In the meantime I solved my problem. After I decided to read and write the RAW-values on the structures (or tags if you wish), the outcomes are predictable. Before that I tried to work with the Values, which went wrong I think because the elements of the structure do not all have the same length.
Question: If I do:
Tag.Value:=something;
myValue:=Tag.Value;
I expect that myValue should equal 'something', which is the tag's Value in the PC. Changing the tag's value does not force an actual ModBus transfer (and is independent of AutoWrite On/Off). Correct?
But if I want to read the actual value in the PLC I do:
Tag.Value:=something;
Tag.read;
myValue:=Tag.Value;
Here I expect to see myValue reflecting the old value (not necessarily the same as 'something') since Tag.Read is Synchronous, and the assignment depends on the scan. Correct?
I did follow your suggestion to check the retries and it seems to work. So does synchronous mean that my program actually waits until a Write or Read to a tag has been completed (Modbus transfer and all)?
PS I could use some climate control here now.... For a change we have 35 deg C outside, and no airco inside. It makes my thinking go slower!
Regards,
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am looking for a way to read and write values of a LOGO8 from Siemens using lazarus. This is why I found pascalscada. Till now however I did not have success. Is there a demo-project where I can see all the basic steps?
Best Regards
Christian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Currently it works with s7 200/1200/300/400 and might be works with 1500.
Logo8 I never tested.
I'll test. If this works, I'll post the example here.
Em 01/12/2015 18:46, "Christian Greif-Kettmann" cat25451@users.sf.net
escreveu:
Hi,
I am looking for a way to read and write values of a LOGO8 from Siemens
using lazarus. This is why I found pascalscada. Till now however I did not
have success. Is there a demo-project where I can see all the basic steps?
I am trying to access items in a TPLCStruct as follows:
myStr_Spd: TPLCStructItem; //which is an element of Mystruct:TPLCStruct, without a protocol driver attached
temp:double;
movespeed:integer=300;
....
myStr_Spd.Value:=move_speed;
temp:=myStr_spd.Value; // temp <> move_speed ??? This puzzles me
The IDE Autocomplete suggests: myStr_Spd.SetValue(move_speed) but the compiler does not allow this (no Member SetValue). With an HMIEditBox, I can change the value, which I did for testing, but now I'd like to assign values to the tags via a procedure...
So: Why can I assign a value, but get something else in return? What am I doing wrong?
How should I assign a value to a PLCStructItem type tag? The items in the structure are not all of the same tagtype. Do I have to make a TArrayOfDouble, set the values for the elements, and then write the whole array to Mystruct?
Is it correct that in "PLCBlock1.Write(cmd,2,3) \" the "3" refers to the element of the Block with index 3 where the writing of the dynamic array's contents begins?
Michael
Last edit: michael hompus 2015-06-29
Sorry Michael by this delay. I'm starting up a climate control on last days.
Well, I don't know what happens, I'll try build a example to study your case. If You have a example project, this will speed up my analisys.
Hi Fabio,
In the meantime I solved my problem. After I decided to read and write the RAW-values on the structures (or tags if you wish), the outcomes are predictable. Before that I tried to work with the Values, which went wrong I think because the elements of the structure do not all have the same length.
Question: If I do:
Tag.Value:=something;
myValue:=Tag.Value;
I expect that myValue should equal 'something', which is the tag's Value in the PC. Changing the tag's value does not force an actual ModBus transfer (and is independent of AutoWrite On/Off). Correct?
But if I want to read the actual value in the PLC I do:
Tag.Value:=something;
Tag.read;
myValue:=Tag.Value;
Here I expect to see myValue reflecting the old value (not necessarily the same as 'something') since Tag.Read is Synchronous, and the assignment depends on the scan. Correct?
I did follow your suggestion to check the retries and it seems to work. So does synchronous mean that my program actually waits until a Write or Read to a tag has been completed (Modbus transfer and all)?
PS I could use some climate control here now.... For a change we have 35 deg C outside, and no airco inside. It makes my thinking go slower!
Regards,
Michael
Hi,
I am looking for a way to read and write values of a LOGO8 from Siemens using lazarus. This is why I found pascalscada. Till now however I did not have success. Is there a demo-project where I can see all the basic steps?
Best Regards
Christian
I'll test if pascalscada Isotcp works with logo8.
Currently it works with s7 200/1200/300/400 and might be works with 1500.
Logo8 I never tested.
I'll test. If this works, I'll post the example here.
Em 01/12/2015 18:46, "Christian Greif-Kettmann" cat25451@users.sf.net
escreveu:
I'll test if pascalscada Isotcp works with logo8.
Currently it works with s7 200/1200/300/400 and might be works with 1500. Logo8 I never tested.
I'll test this week. If this works, I'll post the example here.
Your logo has a ethernet port available? If yes, can you check if port 102 TCP is open? (use a network scanner tool)
Hi Christian!
I posted today a LogoV8 example. Please look at:
https://sourceforge.net/p/pascalscada/code/HEAD/tree/trunk/examples/demo_logo8/
It uses ethernet communcation.
The best regards,
Fabio
Last edit: Fabio Luis Girardi 2016-02-02