Siemens SCL IF problem

CharlesM

Member
Join Date
Aug 2005
Location
Arkansas
Posts
1,129
I have the following code that does not work. Its like the first if is not working. What I do is set MW490 to 0 then it counts up to 64. But when it gets to 64 the if should be false but db94.dbd100 always comes out at 3064.

Also can I monitor SCL code while its running? I see break points but I would like to just put the glasses on like in ladder and see values.

Code:
IF MW490 <= 64 AND MW488 >= 64 THEN 
db94.dbd100 := INT_TO_DWORD(MW490 + 3000); 
j := mw490 * 4;
IF db94.dbd100 = DB94.DBD48 THEN 
	 db96.dbd[j] := db450.dbd52 ; // copy value
	 MW490 := MW490 + 1; 
END_IF;
END_IF;
 
Your IF statement says less than or equal to 64, so the IF will be false when MW490 gets to 65

To permit debugging, select Options>Customise, then select the Compiler tab, then check the Create Debug Info tab.
Re-compile the code and download and then the glasses will enable.
When finishing debugging, click on the glasses and then click on Debug>Finish Debugging
 
The debug worked thanks a lot. I don't understand why the IF didn't work. I broke it down into 2 IF's without the AND. That seems to work fine.
 

Similar Topics

Hello All, I am new to programming with Tia Portal and I am having difficulty with something that we have found "easy" in other programming...
Replies
3
Views
2,363
Hello, When you want compare values of an array to a range of numbers is it a right way to do that? FUNCTION ADD VAR_IN_OUT A:ARRAY[1..50]...
Replies
5
Views
2,062
Hi All, I need to try and convert some code from Siemens SCL (TIA16) over to Allen Bradley RS5000. I have attached an image of the SCL and what...
Replies
10
Views
4,045
in the scl code written in screenshot Line 1 condition is false but still the program checking the line 2 condition and says it is true i had...
Replies
3
Views
1,749
I am new to PLC programming. Is there a standard way to incorporate alarms / warnings / events such as the exceptions in C++ or Java where you can...
Replies
5
Views
1,952
Back
Top Bottom