Depending of your version and where you are trying get the tag bit value, by
example, OnValueChangeFirst of the Tag PLCTagNumber, you will get the wrong
value of I0_0 bit.
The Best Regards,
Fabio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How any tag is a descendant of TPLCNumber (including TTagBit) you will get the
value of TTagBit on Value property (a double)
The reason of this, is because you can map a group of bits (TTagBit mapping
bits from 0 to 3, mapping a nibble from a byte, word, ...). See properties
StartBit and EndBit. Because of this, TTagBit.Value is a Double.
To get it as Boolean do:
booleanVar := I0_0.Value<>0;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Next question. My aplication activate connection i set properties
"TCP_UDPPort1.Active:=True;" on FormCreate procedure. If necessary deactivate
connection TCP_UDPPort1.Active:=False; when i close aplication? When i
deactivate connection my aplication frozen.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, you don't need close the connection. TCPUDP_Port does it automatically
when it's destroyed. And yes, depending of your system configuration, it will
freeze (I fixed some of these freezes on the next version).
Please tell-me, are you running the application on a single-core system (one
processor with one core)? What's the OS?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have "I0_0" object. Connected to PLC and procedure I0_0ValueChange works
fine, but haw to get bit status 0 or 1 from this object?
First: What's your PascalSCADA version?
You tried I0_0.Value?
Your component connections are one of:
TCPUDP_Port <- ISOTCPProtocol <- PLCTagNumber <- TagBit or
TCPUDP_Port <- ISOTCPProtocol <- PLCBLock <- PLCBlockElement <- TagBit or
TCPUDP_Port <- ISOTCPProtocol <- PLCStruct <- PLCStructElement <- TagBit
Depending of your version and where you are trying get the tag bit value, by
example, OnValueChangeFirst of the Tag PLCTagNumber, you will get the wrong
value of I0_0 bit.
The Best Regards,
Fabio
I tested PascalSCADA 0.7.2 on Lazarus. My connect is TCPUDP_Port <-
ISOTCPProtocol <- PLCTagNumber <- TagBit.
I0_0 is a first digital input pin on my PLC (S7-1200).
I tested libnodave and i get bit status with function
"b:=NoDave1.GetBit(0,0);" wher b is boolean
I suspect the same on b:=I0_0.value but get double variable.
Haw get bit status on boolean type?
Ah... Your problem is this...
How any tag is a descendant of TPLCNumber (including TTagBit) you will get the
value of TTagBit on Value property (a double)
The reason of this, is because you can map a group of bits (TTagBit mapping
bits from 0 to 3, mapping a nibble from a byte, word, ...). See properties
StartBit and EndBit. Because of this, TTagBit.Value is a Double.
To get it as Boolean do:
booleanVar := I0_0.Value<>0;
I understand. Thanks for quick reply.
Next question. My aplication activate connection i set properties
"TCP_UDPPort1.Active:=True;" on FormCreate procedure. If necessary deactivate
connection TCP_UDPPort1.Active:=False; when i close aplication? When i
deactivate connection my aplication frozen.
No, you don't need close the connection. TCPUDP_Port does it automatically
when it's destroyed. And yes, depending of your system configuration, it will
freeze (I fixed some of these freezes on the next version).
Please tell-me, are you running the application on a single-core system (one
processor with one core)? What's the OS?