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....
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....