Hi dear Tracy, StampWorks page 43: ...RCTIME returned a low value of 10 and a high value of 746. Two lines after we can see ... (695 / 255), and it is the value - 695 - used·for the constant HiScale instead of 746. From where does come this value? Best regards. MichelB
·The hook for this is on page 40 add a Resister of 500 ohms· to 1 k ohms where the lead to ground·is to set this up ···························································
This is how this works when you use the RCTime··
LoScale CON 10 ' raw low reading················· This is the pot adj to the lowest value· 10
HiScale CON 695 ' raw high reading················This is the pot adj to the highest value·746
Span CON HiScale - LoScale ' between lo-to-hi·····This is value betweenlowest value to the highest value·736
Scale CON $FFFF / Span ' scale factor 0..255
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ··Thanks for any··that you may have and all of your time finding them
· · · · Sam
Post Edited (sam_sam_sam) : 11/11/2009 10:28:00 PM GMT
The 746 looks to me like a typo. Everything else in the program and text is based on 695 as the hiScale value. Of course, the actual values will vary and have to be checked for every different setup.
I would look at the fraction 255/685 = 0.372, which is slightly different the text, which for some reason is based on 695 in the denomnator. On a calculator it would be done like this:
(rawVal - loScale) * 255 / (hiScale - loScale) = (rawVal - 10) * 255 / 685.
And the fraction (rawVal - loScale) / (hiScale - loScale) is always less than or equal to one, that is, a proportion.
The program itself uses the span factor of 685 in the deminator, not 695.
The program has what seems to be a convoluted way to fill in the solid bar. It could be done with one formula, I think, like this,
newBar = DCD (grafval / 32)
IF (GraphMode=BarGraph) THEN newbar=newBar<<1-1
LEDs= newBar
For example, if newBar = %100000, then subtracting one gives %11111, and the shift preserves the length. Another way is
newBar=newBar-1 | newBar
that is subtract one and then OR back in the original one.
A function more like a VU meter would use the ncd function:
newBar = DCD (NCD grafval - 1) '<--- this function uses NCD
IF (GraphMode=BarGraph) THEN newbar=newBar<<1-1
LEDs= newBar
NCD is an integer logarithm with much greater sensitivity at low levels (short RCtimes). The original function divides the signal domain into 8 equal regions of 32 steps each.
(An extended open ended answer to a simple question, sorry)
Just to clarify; do you mean that you are getting 695 as your higher pot value instead of 746? And why that may be?
Hi Joshua, the higher pot value got was 748·with the X5 Pot and just before writing this reply I tried with the X6 Pot and I found 664.
Tracy Allen said that the 746 looks to him like a typo. Everything else in the program and text is based on 695 as the hiScale value.
I think that Jon Williams made like me which explains the 2 values 746 and 695 in the text, 748 and 664 in my case.
Comments
To what document are you referring?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
·The hook for this is on page 40 add a Resister of 500 ohms· to 1 k ohms where the lead to ground·is to set this up ···························································
This is how this works when you use the RCTime··
LoScale CON 10 ' raw low reading······ ··········· This is the pot adj to the lowest value· 10
HiScale CON 695 ' raw high reading··············· ·This is the pot adj to the highest value·746
Span CON HiScale - LoScale ' between lo-to-hi····· This is value between lowest value to the highest value·736
Scale CON $FFFF / Span ' scale factor 0..255
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 11/11/2009 10:28:00 PM GMT
Just to clarify; do you mean that you are getting 695 as your higher pot value instead of 746? And why that may be?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
The 746 looks to me like a typo. Everything else in the program and text is based on 695 as the hiScale value. Of course, the actual values will vary and have to be checked for every different setup.
I would look at the fraction 255/685 = 0.372, which is slightly different the text, which for some reason is based on 695 in the denomnator. On a calculator it would be done like this:
(rawVal - loScale) * 255 / (hiScale - loScale) = (rawVal - 10) * 255 / 685.
And the fraction (rawVal - loScale) / (hiScale - loScale) is always less than or equal to one, that is, a proportion.
The program itself uses the span factor of 685 in the deminator, not 695.
The program has what seems to be a convoluted way to fill in the solid bar. It could be done with one formula, I think, like this,
For example, if newBar = %100000, then subtracting one gives %11111, and the shift preserves the length. Another way is
newBar=newBar-1 | newBar
that is subtract one and then OR back in the original one.
A function more like a VU meter would use the ncd function:
NCD is an integer logarithm with much greater sensitivity at low levels (short RCtimes). The original function divides the signal domain into 8 equal regions of 32 steps each.
(An extended open ended answer to a simple question, sorry)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Tracy Allen said that the 746 looks to him like a typo. Everything else in the program and text is based on 695 as the hiScale value.
I think that Jon Williams made like me which explains the 2 values 746 and 695 in the text, 748 and 664 in my case.
@Tracy: Thank you for the newBar explanation.
Best regards.