SW21-EX17-Freq_Measure-Adv.BS2 - Math & Code
MichelB
Posts: 154
Hi, in this program the constant Scale is $200 (512) for "2.0 µs per unit".
How this value (512) has been found? I tried with 65535 / ?
How this value (512) has been found? I tried with 65535 / ?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
P.S.: In BSManual-v2.2 page 345, Demo Program (PULSIN.bs2) we can find:
Scale· CON· $200 (512)· ' 2.0 µs per unit
Where and how they found the value 512?
Post Edited (MichelB) : 11/29/2009 1:18:12 PM GMT
If you read the manual the frequency used by the BS2 depends on the type you are using the two frequencies are 2us and .8us and will affect the timing of commands like PULSOUT, baud rate and other timing dependent commands.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
That scale factor is for use with the */ operator.
$200: 512/256 = 2
useconds = RCvalue */ scale ' multiplies RCvalue times 2 for BS2, E, or PE
$CC: 204/256 = 0.796875, call it 0.8
useconds = RCvalue */ scale ' multiplies RCvalue times 0.8 for BS2SX, P or PX
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com