S7 300 plc

DANGELOUS

Member
Join Date
Jul 2007
Location
CEKMECE
Posts
39
Hi plc guys.
I use S7 300 plc programme and 840d mmc.This machine i want to make some change.The plc programme has 45 errors.When any errors happens output Q60.1 will be 1.I have to use 45 memory byte to make this.m176.0,m176.1....etcI wonder if there is a shorter way of doing this?Thanks again.
 
Here's an FC that uses a loop to scan your 45 marker bytes:

Code:
FUNCTION FC 4 : VOID
TITLE =
VERSION : 0.1

VAR_TEMP
  bAnyBitTrue : BOOL ; 
  iCount : INT ; 
END_VAR
BEGIN
NETWORK
TITLE =
// bAnyBitTrue=False
// For i=0 to 44 
//  if MB[i+176] <> 0 then bAnyBitTrue=True 
// EndFor
// Q60.1 = bAnyBitTrue
	  SET   ; 
	  R	 #bAnyBitTrue; //reset local
	  LAR1  P#M 176.0; //start of fault bits
	  L	 45; //number of bytes to scan
Loop: T	 #iCount; 
	  L	 B [AR1,P#0.0]; 
	  L	 0; 
	  <>I   ; 
	  S	 #bAnyBitTrue; 
	  +AR1  P#1.0; //increment to next byte
	  L	 #iCount; //update loop count
	  LOOP  Loop; 
	  A	 #bAnyBitTrue; 
	  =	 Q	 60.1; 

END_FUNCTION
 
Simon... I'm not sure our DANGELOUS brother knows his bytes from his bits :)

His machine only has 45 errors and he listed marker bits so he could probably just use an accumulative OR (and have 3 spare alarms)

Code:
L MW 176
L MW 178
OW
L MW 180
OW
L 0
<>I
= Q60.1
 
Good point, you can save a load and OR by using double words:

Code:
	  L	 MD   176
	  L	 MD   178
	  OD	
	  L	 0
	  <>D   
	  =	 Q	 60.1
 
L D[AR2 said:
Code:
	 L	 MD 176
	 L	 MD 178
	 OD	
	 L	 0
	 <>D 
	 =	 Q	 60.1

Nice one - I didn't think of purposely overlapping the first double word to maintain the 48 bit length...
 

Similar Topics

merry christmas and happy new year i have a click c0-00dr-d and allen bradley 2711c-t3m. can the panelview talk to the click plc via modbus...
Replies
1
Views
213
Hello. There is a problem with Siemens S7 300. We got a replacement PLC but it does not run the program from the MMC. The new PLC is dated 2011...
Replies
3
Views
682
Hi Any one here please helpmein simulation of s7 300 plc program with factory io. how to connect. plcsim 5 doesnot have option of s7 300 ..:
Replies
2
Views
1,004
Hello, I have a bit of a situation, and I think I know the answer but this font of knowledge may prove something. I want to do the unthinkable...
Replies
6
Views
2,163
hello guys, I'm trying to establish a connection between Indusoft 8.0 & simatic Plcsim but I keep getting the following error: error...
Replies
3
Views
1,353
Back
Top Bottom