0% found this document useful (0 votes)
85 views3 pages

S7-200 Fill Function

This document describes a subroutine called subFill that is used to fill a specified data area in memory with a given byte value. The subroutine takes in parameters for the starting byte address, number of bytes to fill, and the byte value to use as the fill. It uses a loop counter and pointer variable to increment through the data area, storing the fill byte at each memory address location, until the total number of bytes have been filled.

Uploaded by

jmartof3866
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views3 pages

S7-200 Fill Function

This document describes a subroutine called subFill that is used to fill a specified data area in memory with a given byte value. The subroutine takes in parameters for the starting byte address, number of bytes to fill, and the byte value to use as the fill. It uses a loop counter and pointer variable to increment through the data area, storing the fill byte at each memory address location, until the total number of bytes have been filled.

Uploaded by

jmartof3866
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ScannerAndTechniforFreeportv6 / subFill (SBR4)

Block: subFill
Author:
Created: 08/02/2010 09:53:15 pm
Last Modified: 08/09/2010 03:47:00 pm

Symbol Var Type Data Type Comment


EN IN BOOL
LD0 srcByte IN DWORD
LD4 TotalBytes IN DWORD
LB8 FillWith IN BYTE
IN
IN_OUT
OUT
LD9 Counter TEMP DWORD
LD13 Pointer TEMP DWORD
TEMP

1/3
ScannerAndTechniforFreeportv6 / subFill (SBR4)

This function is used to fill a specified data area(srcByte to srcByte + TotalBytes) with a specified Byte(FillWith).

IN:
SrceByte - Starting Byte of array to fill
TotalBytes - How many Bytes to fill
FillWith - What to fill the area with

Temp:
Counter - Used for loop
Pointer - Pointer incremented in the loop for the area to put the "FillWith" data

Example:
IN:
SrcByte = 100
TotalBytes = 10
Fillwith = 'M'

This function will loop 10 times.


1st pass will move 'M' into VB100
2nd pass will move 'M' into VB101
.
.
10th pass will move 'M' into VB109
Network 1 Initialize #Pointer and #Counter
1. Create #Pointer, pointing at VB0
2. Add #srcByte to #Pointer
3. Zero out counter

AlwaysON MOV_DW
EN ENO

&VB0 IN OUT #Pointer

ADD_DI
EN ENO

#srcByte IN1 OUT #Pointer


#Pointer IN2

MOV_DW
EN ENO

+0 IN OUT #Counter

Symbol Address Comment


AlwaysON SM0.0

2/3
ScannerAndTechniforFreeportv6 / subFill (SBR4)

Network 2
LABEL 99
Jump here until all data has been cleared from previous scanned data

99
LBL

Network 3 CLEAR OUT OLD SCANNED DATA


Move #FillWith into #Pointer
Increment POINTER
Increment COUNTER

Example #Pointer area (assume srcByte = 100)


1st - VB100
2nd - VB101
3rd - VB102
.
.
Nth - VB100 + TotalBytes

AlwaysON MOV_B
EN ENO

#FillWith IN OUT *#Pointer

INC_DW
EN ENO

#Pointer IN OUT #Pointer

INC_DW
EN ENO

#Counter IN OUT #Counter

Symbol Address Comment


AlwaysON SM0.0

Network 4
If COUNTER < TotalBytes then jump to 99

#Counter 99
<D JMP
#TotalBytes

3/3

You might also like