Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: mhw on July 02, 2013, 05:39:44 PM
-
I am having problems with the following section of code that has always worked in DS5.
STR X1
STR CT1.Done
CNT CT1 8
STRPD CT1.Done
MATH DLV10 "60000 / T8.Acc"
STRN CT1.Done
TMR T8 0
The result of the math varies by about 25%. Any ideas?
-
1. When you say 'worked' in DS5, how much was the variance?
2. Is it possible X1 is making at an inconsistent rate?
3. What is your expected time for the 8 actuations of X1?
4. Is it possible the input is bouncing? Remember the DoMore's much faster scan time. A clue would be if the time is varying in steps of 1/8 the expected time. Your 25% sounds suspicious.
5. Is this in the $Main routine or somewhere else?
6. Your answer will be in an integral number of seconds for the 8 actuations.
-
I played with the code on the simulator, and I don't see a problem with it.
What are you expecting? Because i don't know how fast the pulse is,but you can only get so accurate with the resolution you are using.
-
1. What is a typical (or actual) value for T8.Acc when the 8th edge of X1 occurs?
2. What is the expected MATH calculation result with the #1 value?
3. What is the actual result you are getting in DLV10?
You could stick a
MOVE T8.Acc V100
in your 2nd rung to store off the exact value used in that calculation to help answer #1 above.
Note that the accumulator values in Do-more are NOT BCD, they're 32 bit signed integer, in case you were looking at the values in Data View with BCD/Hex format.
-
1. When you say 'worked' in DS5, how much was the variance?
Here is the DS5 comparison:
STR X1
STR CT0
CNT CT0 K8
STR CT0
LD K6000
DIV TA3
OUT V11762
STRN CT0
TMRF T3 K9999
END
2. Is it possible X1 is making at an inconsistent rate?
Yes they are inconsistant but not 25% inconsistant. When I put the 260cpu in my test rack it will vary by only 2%.
3. What is your expected time for the 8 actuations of X1?
On my test set it is about 250ms
4. Is it possible the input is bouncing? Remember the DoMore's much faster scan time. A clue would be if the time is varying in steps of 1/8 the expected time. Your 25% sounds suspicious.
I think you are on to something... I will try to debounce and retest when time allows.
5. Is this in the $Main routine or somewhere else?
I have stripped all other code and only have this running in the main program for testing.
3. What is the actual result you are getting in DLV10?
On my test it varies from 211 to 277
-
Curiosity was killing me so I made time. The debounce worked. Thanks to all for your help. An extra special thanks to you Bernie!