arkansascontrols
Lifetime Supporting Member
Simon,
Had a small disaster with a shipment of mislabeled actuators 110v devices don't like 230v for some reason. Anyway, I have had some time to step through the changes you made to the routine (by the way got it working very nicely now) many thanks to you. And I have a couple of questions for you. As you may have figured out my brain won't let me accept something just because it works, I have to know why. I didn't actually just load the routine you sent back, I implemented the changes individually and systematically until I found exactly what was broken in my original routine.
Please explain if you can the functional difference between
LAR1 #SomeVariable
and
L #SomVariable
LAR1
Also please explain why a KNOWN integer value stored in DINT variable type will not correctly translate unless you load it as 2 byte variable and convert it.
L W[AR1,P#0.0]
ITD
T #diDintVariable
and
L D[AR1,P#0.0]
T #diDintVariable
should both result in the same value of diDintVariable if the value of bytes 0 and 1 are both 0's
In other words an integer value stored in a DINT variable type will remain entirely with the two latter bytes so regardless of how you get the two bytes copied to the 4 byte variable the resulting value of the 4 byte variable should be same.
But what I found was that only these two changes (above) were necessary to my routine to make it work with the INT types I was testing (I had quite a lot wrong with the reals but had not begun testing them yet). Also, initializing the variables solved a problem I was having with random miscalculations, but I understood that one.
Thank you again for your guidance on this.
Eric
Had a small disaster with a shipment of mislabeled actuators 110v devices don't like 230v for some reason. Anyway, I have had some time to step through the changes you made to the routine (by the way got it working very nicely now) many thanks to you. And I have a couple of questions for you. As you may have figured out my brain won't let me accept something just because it works, I have to know why. I didn't actually just load the routine you sent back, I implemented the changes individually and systematically until I found exactly what was broken in my original routine.
Please explain if you can the functional difference between
LAR1 #SomeVariable
and
L #SomVariable
LAR1
Also please explain why a KNOWN integer value stored in DINT variable type will not correctly translate unless you load it as 2 byte variable and convert it.
L W[AR1,P#0.0]
ITD
T #diDintVariable
and
L D[AR1,P#0.0]
T #diDintVariable
should both result in the same value of diDintVariable if the value of bytes 0 and 1 are both 0's
In other words an integer value stored in a DINT variable type will remain entirely with the two latter bytes so regardless of how you get the two bytes copied to the 4 byte variable the resulting value of the 4 byte variable should be same.
But what I found was that only these two changes (above) were necessary to my routine to make it work with the INT types I was testing (I had quite a lot wrong with the reals but had not begun testing them yet). Also, initializing the variables solved a problem I was having with random miscalculations, but I understood that one.
Thank you again for your guidance on this.
Eric
Last edited: