Difference between revisions of "IBH Link UA:Variable Syntax"
(Created page with "== Common Syntax for S5 and S7: == <table> {| border="1" <tr class="odd"> <td align="left">'''Operand'''</td> <td align="left">'''Bereich'''</td> <td align="left">'''Datentyp...") |
m (→Common Syntax for S5 and S7:) |
||
Line 2: | Line 2: | ||
<table> | <table> | ||
− | {| border=" | + | {| border="0" |
<tr class="odd"> | <tr class="odd"> | ||
<td align="left">'''Operand'''</td> | <td align="left">'''Operand'''</td> |
Revision as of 11:20, 1 September 2016
Contents
Common Syntax for S5 and S7:
Operand | Bereich | Datentyp |
En.n | Inputbits (2) | Bool (VT_BOOL) |
EBn | Inputbytes (1) | Unsigned Byte (VT_UI1) |
EWn | Inputwords (1) | Unsigned Word (VT_UI2) |
EDn | Inputdoublewords (1) | Unsigned DWord (VT_UI4) |
ETn[Stringlength] | Text from the input area (3) | Character Array (VT_BSTR) |
An.n | Outputbits (2) | Bool (VT_BOOL) |
ABn | Outputbytes (1) | Unsigned Byte (VT_UI1) |
AWn | Outputwords (1) | Unsigned Word (VT_UI2) |
ADn | Outputdoublewords (1) | Unsigned DWord (VT_UI4) |
ATn[Stringlength] | Text from the output area (3) | Character Array (VT_BSTR) |
Mn.n | Flagbits (2) | Bool (VT_BOOL) |
MBn | Flagbytes (1) | Unsigned Byte (VT_UI1) |
MWn | Flagwords (1) | Unsigned Word (VT_UI2) |
MDn | Flagdoublewords (1) | Unsigned DWord (VT_UI4) |
MTn[Stringlength] | Text from the flag area (3) | Character Array (VT_BSTR) |
Syntax for S5:
Operand | Bereich | Datentyp |
Dn.n,nr | Databits, DB | Bool (VT_BOOL) |
DRn,nr | Right Databyte, DB | Unsigned Byte (VT_UI1) |
DLn,nr | Left Databyte, DB | Unsigned Byte (VT_UI1) |
DWn,nr | Dataword, DB (1) | Unsigned Word (VT_UI2) |
DSn,nr | Dataword, DB (1) | Signed short Integer (VT_I2) |
DDn,nr | Datadoubleword, DB (1) | Unsigned DWord (VT_UI4) |
DVn,nr | Datadoubleword, DB (1) | Signed long integer (VT_I4) |
DFn,nr | Datadoubleword, DB (1) | Float (VT_R4) |
DTn,nr[Stringlength] | Text from a datablock (3) | Character Array (VT_BSTR) |
DXn.n,nr | Databits, DX | Bool (VT_BOOL) |
DXRn,nr | Right Databyte, DX | Unsigned Byte (VT_UI1) |
DXLn,nr | Left Databyte, DX | Unsigned Byte (VT_UI1) |
DXWn,nr | Dataword, DX (1) | Unsigned Word (VT_UI2) |
DXSn,nr | Dataword, DX (1) | Signed short Integer (VT_I2) |
DXDn,nr | Datadoubleword, DX (1) | Unsigned DWord (VT_UI4) |
DXVn,nr | Datadoubleword, DX (1) | Signed long integer (VT_I4) |
DXFn,nr | Datadoubleword, DX (1) | Float (VT_R4) |
DXTn,nr[Stringlength] | Text from a DX datablock (3) | Character Array (VT_BSTR |
Sn.n | S-Flagbits (2) | Bool (VT_BOOL) |
SYn | S-Flagbytes (1) | Unsigned Byte (VT_UI1) |
SWn | S-Flagwords (1) | Unsigned Word (VT_UI2) |
SSn | S-Flagwords (1) | Signed short Integer (VT_I2) |
SDn | S-Flagdoublewords (1) | Unsigned DWord (VT_UI4) |
SVn | S-Flagdoublewords (1) | Signed long integer (VT_I4 |
SFn | S-Flagdoublewords (1) | Float (VT_R4) |
STn[Stringlength] | Text from the extended flag area (3) | Character Array (VT_BSTR |
Syntax for S7:
Operand | Bereich | Datentyp |
DBn.DBXn.n | DB, Databits (2) | Bool (VT_BOOL) |
DBn.DBBn | DB, Databyte (1) | Unsigned Byte (VT_UI1) |
DBn.DBCn | DB, Databyte (1) | Signed Byte (VT_I1) |
DBn.DBWn | DB, Dataword (1) | Unsigned Word (VT_UI2) |
DBn.DBSn | DB, Dataword (1) | Signed Word (VT_I2) |
DBn.DBDn | DB, Datadoubleword (1) | Unsigned DWord (VT_UI4) |
DBn.DBVn | DB, Datadoubleword (1) | Signed DWord (VT_I4 |
DBn.DBRn | DB, Real (1) | Real (VT_R4) |
DBn.DBLn | DB, LongLong (64 Bit) (1) | LONGLONG (VT_I8) |
DBn.DBUn | DB, ULongLong (64 Bit) (1) | ULONGLONG (VT_UI8) |
DBn.DBZn | DB, S7 - DATE_AND_TIME (1) | Date (VT_DATE) |
DBn.DBTn[Stringlength] | Text from a datablock (3) | Character Array (VT_BSTR) |
1) For these operands the suffix [Count] may be added to read/write arrays. Example: PLCName.DB10.DBB2[5] reads 5 bytes starting from DBB2. PLCName.MW4[7] reads 7 Words starting from the MW4.
2) For bit operands also the suffix [Count] may be added to read/write arrays. Arrays of boolean must always start with Bit 0 within the byte. Example: PLCName.DB10.DBX2.0[5] reads 5 Bits starting from DBX2.0. PLCName.M4.0[7] reads 7 Bits starting from M4.0. A variable like PLCName.M4.3[4] is not permitted. When writing boolean arrays, always the entire byte is written.
3) If strings are entered in absolute notation, there is no verification whether it is a declared string. In S7 PLCs, strings have 2 leading bytes with additional information regarding the string, the declared length and the current length. Since this information lacks in absolute notation, strings are treated as pure character arrays of the length entered in [Stringlength]. If in a write operation the text is shorter as the length enterd in [Stringlength], the rest is filled up with zeroes.
The 'signed' datatypes also exist for the S7. Normally, we assume that the type will be set via the configuration tool IBH OPCEditor.
Addressing the DB of a S7-200:
The syntax for the 200 equals the S7-300 syntax. To access a variable byte of the data block in S7-300 syntax you need to type: VB 2 (S7-200) = DB1.DBB2 (S7-300). The data block is always the DB1. A variable word VW 2 (S7-200) = DB1.DBW2 (S7-300). A variable doubleword VD 2 (S7-200) = DB1.DBD2 (S7-300).