S7 FiFo

Sparkyman

Member
Join Date
Jun 2008
Location
CHESTER
Posts
3
Hi
Can anyone help me to set up a 40 pocket FIFO in a seimens S7-315, i only need to move one word, i could write a function block but there must be a quicker way !!???
 
Sorry I don't have access to S7 at the moment, so cannot even remember the block name.

Have you tried inserting it into the code and doing a 'F1' help on it, it may pop up the help descriptor.

Failing that, insert a screen dump of the block call and say which parameters you need explaining.

I have use this block some time ago, but haven't seen it for awhile.
 
Here's the source code of an example using OB1, FB1 and DB88. Paste this into a source code container and compile it to generate the blocks. It will overwrite any existing OB1, FB1 or DB88 (FC84 and FC85 need to be in the blocks folder for the code to compile)

Code:
DATA_BLOCK DB 88
TITLE =
VERSION : 0.0
FB 1
BEGIN
wDataToAdd := W#16#0; 
bAddToFIFO := FALSE; 
bRemoveFromFIFO := FALSE; 
wDataFromFIFO := W#16#0; 
wFIFO[1] := W#16#28; 
wFIFO[2] := W#16#0; 
wFIFO[3] := W#16#0; 
wFIFO[4] := W#16#0; 
wFIFO[5] := W#16#0; 
wFIFO[6] := W#16#0; 
wFIFO[7] := W#16#0; 
wFIFO[8] := W#16#0; 
wFIFO[9] := W#16#0; 
wFIFO[10] := W#16#0; 
wFIFO[11] := W#16#0; 
wFIFO[12] := W#16#0; 
wFIFO[13] := W#16#0; 
wFIFO[14] := W#16#0; 
wFIFO[15] := W#16#0; 
wFIFO[16] := W#16#0; 
wFIFO[17] := W#16#0; 
wFIFO[18] := W#16#0; 
wFIFO[19] := W#16#0; 
wFIFO[20] := W#16#0; 
wFIFO[21] := W#16#0; 
wFIFO[22] := W#16#0; 
wFIFO[23] := W#16#0; 
wFIFO[24] := W#16#0; 
wFIFO[25] := W#16#0; 
wFIFO[26] := W#16#0; 
wFIFO[27] := W#16#0; 
wFIFO[28] := W#16#0; 
wFIFO[29] := W#16#0; 
wFIFO[30] := W#16#0; 
wFIFO[31] := W#16#0; 
wFIFO[32] := W#16#0; 
wFIFO[33] := W#16#0; 
wFIFO[34] := W#16#0; 
wFIFO[35] := W#16#0; 
wFIFO[36] := W#16#0; 
wFIFO[37] := W#16#0; 
wFIFO[38] := W#16#0; 
wFIFO[39] := W#16#0; 
wFIFO[40] := W#16#0; 
wFIFO[41] := W#16#0; 
wFIFO[42] := W#16#0; 
END_DATA_BLOCK
 
FUNCTION_BLOCK FB 1
TITLE =
VERSION : 0.1
 
VAR_INPUT
wDataToAdd : WORD ; 
bAddToFIFO : BOOL ; 
bRemoveFromFIFO : BOOL ; 
END_VAR
VAR_OUTPUT
wDataFromFIFO : WORD ; 
END_VAR
VAR
wFIFO : ARRAY [1 .. 42 ] OF WORD := W#16#28, W#16#0; 
END_VAR
VAR_TEMP
bCalcTime : BOOL ; 
bElapsedTime : TIME ; 
END_VAR
BEGIN
NETWORK
TITLE =add to fifo
	 A	 #bAddToFIFO; 
	 JNB _001; 
	 CALL "ATT" (
		 DATA					 := #wDataToAdd,
		 TABLE					:= #wFIFO);
_001: NOP 0; 
NETWORK
TITLE =remove from fifo
	 A	 #bRemoveFromFIFO; 
	 JNB _002; 
	 CALL "FIFO" (
		 TABLE					:= #wFIFO,
		 RET_VAL				 := #wDataFromFIFO);
_002: NOP 0; 
END_FUNCTION_BLOCK
 
ORGANIZATION_BLOCK OB 1
TITLE = "Main Program Sweep (Cycle)"
VERSION : 0.1
 
VAR_TEMP
OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
OB1_SCAN_1 : BYTE ; //1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1)
OB1_PRIORITY : BYTE ; //Priority of OB Execution
OB1_OB_NUMBR : BYTE ; //1 (Organization block 1, OB1)
OB1_RESERVED_1 : BYTE ; //Reserved for system
OB1_RESERVED_2 : BYTE ; //Reserved for system
OB1_PREV_CYCLE : INT ; //Cycle time of previous OB1 scan (milliseconds)
OB1_MIN_CYCLE : INT ; //Minimum cycle time of OB1 (milliseconds)
OB1_MAX_CYCLE : INT ; //Maximum cycle time of OB1 (milliseconds)
OB1_DATE_TIME : DATE_AND_TIME ; //Date and time OB1 started
bFalse : BOOL ; 
bTrue : BOOL ; 
END_VAR
BEGIN
NETWORK
TITLE =
	 O	 #bTrue; 
	 ON	#bTrue; 
	 =	 L	 21.0; 
	 A	 L	 21.0; 
	 BLD 102; 
	 =	 #bTrue; 
	 A	 L	 21.0; 
	 NOT ; 
	 =	 #bFalse; 
NETWORK
TITLE =add
 
	 A	 #bTrue; 
	 =	 L	 21.0; 
	 BLD 103; 
	 A	 #bFalse; 
	 =	 L	 21.1; 
	 BLD 103; 
	 A	 I	 0.0; 
	 FP	M	 1.0; 
	 JNB _001; 
	 CALL FB	 1 , DB	88 (
		 wDataToAdd			 := MW 100,
		 bAddToFIFO			 := L	 21.0,
		 bRemoveFromFIFO		 := L	 21.1);
_001: NOP 0; 
NETWORK
TITLE =remove
	 A	 #bFalse; 
	 =	 L	 21.0; 
	 BLD 103; 
	 A	 #bTrue; 
	 =	 L	 21.1; 
	 BLD 103; 
	 A	 I	 0.1; 
	 FP	M	 1.1; 
	 JNB _002; 
	 CALL FB	 1 , DB	88 (
		 bAddToFIFO			 := L	 21.0,
		 bRemoveFromFIFO		 := L	 21.1,
		 wDataFromFIFO			:= MW 102);
_002: NOP 0; 
END_ORGANIZATION_BLOCK
 

Similar Topics

I am not sure if this is possible but if there is a way, you guys would be the ones to know. I am currently working on a project where we are...
Replies
7
Views
288
Hello all, I'm using a 5069-L330ER in a project and I need to essentially capture some data that will be shown as a trend on a screen. The data...
Replies
9
Views
1,009
Hello! I have a network of conveyors bringing raw product to 4 machines. A sensor in the hopper of each machine calls for more product. I'm...
Replies
15
Views
5,957
Hello everyone, has anyone out there ever made a FIFO using an FFL and FFU instructions on a Micro800? I have tried setting it up just as I would...
Replies
9
Views
3,172
I have a bottle capper that is using an encoder and FIFO logic to track the free standing bottles passing through a bottle capper. I have checked...
Replies
31
Views
11,788
Back
Top Bottom