10 REM *** 12 REM Example program showing one way to expand memory storage of an 05 or 13 REM 06 PLC using the F0-CP128 14 REM This example uses absolute memory accesses in the F0-CP128 16 REM V2000-V2177 will be source/destination in the PLC 18 REM V3000 will specify a block number in the F0-CP128 memory 20 REM The Block number will be between 0 and 127 (128 blocks) 22 REM C100 Triggers copy from V2000-V2177 to F0-CP128 specified block # 24 REM C101 Triggers copy from F0-CP128 specified block # to V2000-V2177 26 REM Set C100 or C101 using One Shot (PD) to SET Coil, BASIC program will 28 REM turn off the C's when the move is complete 30 REM 32 REM This example will allow 128 blocks of 256 bytes each for a total of 34 REM 32768 bytes or 16384 words 40 REM --- 50 REM *** 52 STRING 2551,254 54 SETPORT 1,9600,N,8,1,N : REM Port 1 Programming/Debug 56 MEM_START=75776 : REM Pointer to start of storage memory 58 MEM_FSET=0 : REM Offset / Each Block will be 256 bytes 99 PRINT1 "Program Started" 100 REM *** 102 REM Check for C100 or C101 110 IF S06_C(100) THEN GOSUB 200 : REM Trigger Copy from PLC 120 IF S06_C(101) THEN GOSUB 300 : REM Trigger Copy from F0-CP128 130 GOTO 110 : REM Loop Forever 200 REM *** 202 REM Copy V2000-V2177 to specified block in F0-CP128 204 BLOCK=S06_VB(3000) 206 IF BLOCK>127 THEN GOTO 250 208 MEM_FSET=BLOCK*256 : REM Calculate Offset 210 PRINT1 "---": PRINT1 "Reading Data from V2000-V2177" 212 BMOVE R,VH(2000),K(256) : REM Read Source Data 214 PRINT "Writing Data to F0-CP128 memory - Block #",BLOCK 220 FOR X=0 TO 256 STEP 2 222 WORD(MEM_START+MEM_FSET+X)=DPORT(X) : REM Copy Data 224 NEXT X 230 PRINT1 "Turning off C100" 232 S06_C(100)=0 : REM Turn Off C100 240 RETURN 250 REM --- 252 REM Handle Invalid Block # 260 S06_VB(3000)=9999 262 PRINT1 "---" : PRINT1 "Invalid Block # on PLC to CoPro Request" 264 S06_C(100)=0 270 RETURN 300 REM *** 302 REM Copy specified block in F0-CP128 to V2000-V2177 304 BLOCK=S06_VB(3000) 306 IF BLOCK>127 THEN GOTO 350 308 MEM_FSET=BLOCK*256 : REM Calculate Offset 310 PRINT1 "---": PRINT1 "Reading Data from F0-CP128 memory - Block #",BLOCK 312 FOR X=0 TO 256 STEP 2 314 DPORT(X)=WORD(MEM_START+MEM_FSET+X) : REM Copy Data 316 NEXT X 320 PRINT "Writing Data to V2000-V2177" 322 BMOVE W,VH(2000),K(256) : REM Write Source Data 330 PRINT1 "Turning off C101" 332 S06_C(101)=0 : REM Turn Off C101 340 RETURN 350 REM --- 352 REM Handle Invalid Block # 360 S06_VB(3000)=9999 362 PRINT "---" : PRINT1 "Invalid Block # on CoPro to PLC Request" 364 S06_C(101)=0 370 RETURN