Bitte beachten Sie: Bei diesem Artikel handelt es sich um eine maschinelle Übersetzung. Die originale FAQ ist hier zu finden. SBC stellt diese Informationen ohne Gewähr für Richtigkeit bzw. Funktionalität zur Verfügung und übernimmt auch keine Gewährleistung bezüglich der Vollständigkeit oder Richtigkeit der Übersetzung.

PCD Anweisung Wich ermöglicht, um einen Text in einen anderen Text zu kopieren.

FAQ #100886

Kopieren Texte in andere Texte unterstützen die PCDs-jetzt. Die Formate (@, $,...) werden unterstützt, im Quelltext als auch die erlaubt, den Inhalt des Registers direkt in einen Text einzugeben.

 

List of the minimal FW which is needed to support the copy text to text functionality:

PCD typeMinimum
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 
0no error
1Fatal error, failure in media definitions (wrong media)
2The count parameter  is a constant with a value different from 0
3Source or destination is neither text nor db
4Source text doesn't exist
5Destination text doesn't exist
6Destination = Source
7Source is DB
8Destination is not writable
9Forbidden first character ( 0xFD, 0xFE, 0xFF ) in destination text at text number < 4000.
10Forbidden character in destination text  at text number < 4000.
11  Error while copying text
12Not whole text copied ( destination too short )
13The 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: 29.05.2015 02:59

First release: 21.02.2008 13:25

Views: 7981

Die von Ihnen angeforderte Software / Dokument wird von der Saia-Burgess Controls AG nicht mehr vermarktet und technisch unterstützt. Es handelt sich um eine ältere Software-Version, die lediglich auf bestimmten, mittlerweile nicht mehr im Handel erhältlichen Produkten betrieben werden kann.

Download