L W#16#3230 // Load ASCII first and second value of the year ‘20‘ (for 2000 year)
T LW 26 // Save in temporary ASCII array
L P#0.0 // Load start address
LAR1 // Save this address in address register 1
L 0 // Load start address
SLD 3 // Create pointer
+AR1 // Add this value to address register 1
L P#0.0 // Load start address
LAR2 // Save this address in address register 2
L 28 // Load start address
SLD 3 // Create pointer
+AR2 // Add this value to address register 2
// Conversion from BCD format to ASCII format
L 8 // Load number of loops
Next: NOP 1 // Do nothing
T #Index_ASCII // Save actual loop number as Index ASCII
L LB 【AR1,P#0.0】 // Load value from address in address register 1
SRW 4 // Shift bits four places to the right
L B#16#30 // Load value 0 in ASCII
OW // Do OR operation with bits
SLW 8 // Shift bits eight places to the right
T LW 【AR2,P#0.0】 // Save this value to address in address register 2
L LB 【AR1,P#0.0】 // Load value from address in address register 1
L DW#16#F // Load F value
AW // Do AND operation with bits
L B#16#30 // Load value 0 in ASCII
OW // Do OR operation with bits
L LW 【AR2,P#0.0】 // Load value from address in address register 2
OW // Do OR operation with bits
T LW 【AR2,P#0.0】 // Save this value to address in address register 2
+AR1 P#1.0 // Add one byte to address register 1
+AR2 P#2.0 // Add two bytes to address register 2
L #Index_ASCII // Before next loop load actual loop counter
LOOP Next // Decrease actual loop counter and jump to "Next" label
LAR1 P##Date_time_ASCII // Load pointer of destination data block and set all parameters
L B#16#10 // Load value 10 (for S7 always the same)
T LB 【AR1,P#0.0】 // Set this value in right place in "Destination" pointer
L B#16#2 // Load value 2 (data type - BYTE)
T LB 【AR1,P#1.0】 // Set this value in right place in "Destination" pointer
L 22 // Load number bytes to copy (repetition factor)
T LW 【AR1,P#2.0】 // Set this value in right place in "Destination" pointer
L #DB_date_and_time // Load DB number
T LW 【AR1,P#4.0】 // Set this value in right place in "Destination" pointer
L P#DBX 16.0 // Load start memory area to copy data
T LD 【AR1,P#6.0】 // Set this value in right place in "Destination" pointer
CALL "BLKMOV" // Using actual date and time in ASCII format
SRCBLK :=#Date_time_ASCII_array // And "Destination" pointer
RET_VAL:=#Temp // Copy data from source area
DSTBLK :=#Date_time_ASCII // To destination area
213255tony :你好!能否提供完整的S7-300程序?上面的STL中Next:NOP 1这个好象不对,正确是Next:T #Index_ASCII
谢谢!