PCD instructie die het mogelijk maakt om te kopiëren van een tekst in een andere tekst.
FAQ #100886
De PCD nu ondersteuning teksten kopiëren naar andere teksten. De formaten (@, $,...) worden ondersteund in de brontekst, die het mogelijk maakt om de inhoud van register geven direct in een tekst.
List of the minimal FW which is needed to support the copy text to text functionality:
PCD type | Minimum FW version |
D1.M1x5 | $A5 |
D2.M150 | $D1 |
Dx.M170 | $21 |
S1.C6/C8 | $B2 |
D2.M480 | $29 |
D3.Mxxxx | $25 |
Instruction CopyText:
CSF | Library | ; S.APPLICATION.Library |
Function | ; S.APPLICATION.CopyText | |
Source | ; X/K 0…7999 | R 0...4095/16383*2 | |
Destination | ; X/DB/K 0…7999 | R 0...4095/16383*2 | |
Count | ; R 0…4095/16383*2 | K 0 | 0 | |
ErrorCode | ; R 0…4095/16383*2 | K 0 | 0 |
*2 16383 Register are only available on NT-Systems (PCD2.M4.., PCD2.M5.., PCD3.)
other PCD’s have maximal 4095 registers.
Description of the parameter of the instruction CopyText:
Source | number of TEXT It’s possible that this text contains formats (@,$,… ) |
Destination | number of DB or number of TEXT |
Count | number of bytes have been copied into the destination buffer if K 0 or 0 no reporting |
ErrorCode | error code if K 0 or 0 no reporting |
Description of the function CopyText:
CopyText starts with rewriting of the whole destination text string with spaces (0x20).
If the Destination is too short, not the whole text is copied, but as many characters as possible.
The count register contains the number of copied characters.
If the source length is smaller or equal to the destination length the number of copied character is equal to the source length, all character are copied, and no error indication and the error flag is set.
If the source length exceeds the destination length the number of copied character is equal to the destination length, not all character are copied, and error code 12 with error flag is set.
The Error Flag of the PCD is set if any error occurs ( for example "Destination too short", "Destination not writable", "Source is a DB", "Wrong Parameters", "Text or DB doesn't exist", "Source = Destination", ... )
List with the error values for the ErrorCode
Value | |
0 | no error |
1 | Fatal error, failure in media definitions (wrong media) |
2 | The count parameter is a constant with a value different from 0 |
3 | Source or destination is neither text nor db |
4 | Source text doesn't exist |
5 | Destination text doesn't exist |
6 | Destination = Source |
7 | Source is DB |
8 | Destination is not writable |
9 | Forbidden first character ( 0xFD, 0xFE, 0xFF ) in destination text at text number < 4000. |
10 | Forbidden character in destination text at text number < 4000. |
11 | Error while copying text |
12 | Not whole text copied ( destination too short ) |
13 | The count parameter is neither a register nor a constant |
The CSF exists with error on wrong media type of the ErrorCode Parmater, and on all indicated errors.
Note :
The Destination text/db must be writable ( RAM resident ) and the user has to include the ApplicationLib.inc before using this csf.
Example:
Source text:
Text 100 “Alarm on station 10, @L0100. Motor is to hot. Temperature is $R0110°C.
Please call $L0020”
Register 100 has the value 2
Register 0110 has the value 220
Text 2 “Section B”
Text 20 “John at the number 044 345 32 32”
The Register 100 contains the pointer to the sub-text.
If the Register 100 has the value 2 then the text 2 is inserted on the position @L0100.
After copying the source text to the destination text, the destination text will be the following:
“Alarm on station 10, Section B. Motor is to hot. Temperature is 220°C. Please call John at the number 044 345 32 32”
The PG5 Example can be downloaded from this FAQ.
Categories
Local FAQ Deutschland / SEdit (IL programming)
PG5 2.0 / Mode-C
Last update: 09.05.2015 05:57
First release: 21.02.2008 13:25
Views: 7958