Simple but Frustrating problem with Siemens STL Programming...

JonHopper

Member
Join Date
Feb 2010
Location
Ontario
Posts
39
Hello everyone, I have been attempting to complete a simple weight conversion program... basically it loads in 3 values from a BCD Thumbwheel: Actual weight, Nominal Weight, and percent tolerance. Each value is entered in through the flipping of a switch (as you can see from the program below).

Also , the 4th switch (0.3) acts as a contact switch on the virtual "weight table" which enables a 2 second timer before calculating and displaying whether the actual weight is within the limits.

My problem: The BDC Values are being loaded in immediately, regardless of the AND statements with the respective switches. (Ie. 0.0 to 0.2 inputs do absolutely nothing the values are immediately loaded in)

Also the last line: Switch 0.3 is ANDED with the comparator, and yet the comparator functions independently of the AND statement (m230 becomes true regardless of the position of switch 0.3).

Any help would be appreciated as I am extremely frustrated by such a simple problem...

Just so you know I wrote a program to perform the same function in LAD about a month ago and it worked fine.

Heres the STL Code:

// actual weight input
A "Switch 0 (Weight)"
A(
L "BCD"
BTI
ITD
DTR
T MD 206
)
// nominal weight input

A "Switch 1 (NomWeight)"
A(
L "BCD"
BTI
ITD
DTR
T MD 106
)
// tolerance input
A "Switch 2 (Tolerance)"
A(
L "BCD"
BTI
ITD
DTR
T MD 116
L MD 116
L 1.000000e+002
/R
T MD 120
)

// MATH
// percentage of weight
A(
L MD 106
L MD 120
*R
T MD 124
SAVE
)
// upper limit
A(
L MD 106
L MD 124
+R
T MD 128
SAVE
)
// lower limit
A(
L MD 106
L MD 124
-R
T MD 132
SAVE
)
// bag on weight timer and comparators
A(
A "Switch 3 (Bag On)"
L S5T#2S
SD T 1
L T 1
T MW 240
)

A "Switch 3 (Bag On)"
A(
L MW 240
L 0.000000e+000
==I
)
= M 230.0



THANK YOU IN ADVANCE....
 
The reason that your math doesnt seem to follow the logic, is because load, transfer and math instructions are executed explicitly, with no regard for the RLO.

I suggest you make your conditional math in LAD, then it is not so easy to screw it up.
If you want to see how the conditional math is executed, then switch the LAD code to STL view. You can see that the conditional math is done by conditional jumps past the math code.
 
The reason that your math doesnt seem to follow the logic, is because load, transfer and math instructions are executed explicitly, with no regard for the RLO.

I suggest you make your conditional math in LAD, then it is not so easy to screw it up.
If you want to see how the conditional math is executed, then switch the LAD code to STL view. You can see that the conditional math is done by conditional jumps past the math code.


Thanks a lot. Seems like something the professor should have taught us. Makes a lot of sense now. I'll try it and report back.
 
Thanks for the help, I now udnerstand the jump commands and their purpose.

I have most of it working, I'm still working on getting the comparators to work properly.

I will post the final version of the code for anyone who needs it for future reference.
 

Similar Topics

Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
169
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
6
Views
254
I'm trying to build my Classic Step 7 programming skills this weekend. I get stuck on little things that are not covered in YouTube tutorials. I'm...
Replies
7
Views
318
I have a program that does a 7 second "scan" sensor calibration routine whenever a setting (setting is called assistance level or "AL" and ranges...
Replies
3
Views
212
Hi all, I have a simple question that I have overcomplicated and gotten stuck on. I have a variable, we can call it "light" that I need to stay...
Replies
4
Views
316
Back
Top Bottom