confusing numbers
Jayguy5000
Posts: 139
in the book, IRremoteBoeBot there is the following paragraph
Inside the DO…LOOP, the program executes the command PULSIN 9, 0, time, which
measures pulses. Whenever a pulse duration is between 975 (1.95 ms) and 1425 (2.85
ms), the IF…THEN…ENDIF code block increments the counter variable and displays the
counter and time variables under the Repetitions and Current Duration headings. <~~~pg 13
how does 975 = 1.95 mS and 1425 = 2.85 mS ???
I cant figure it out to save my life...
~Jeremy
Inside the DO…LOOP, the program executes the command PULSIN 9, 0, time, which
measures pulses. Whenever a pulse duration is between 975 (1.95 ms) and 1425 (2.85
ms), the IF…THEN…ENDIF code block increments the counter variable and displays the
counter and time variables under the Repetitions and Current Duration headings. <~~~pg 13
how does 975 = 1.95 mS and 1425 = 2.85 mS ???
I cant figure it out to save my life...
~Jeremy
Comments
PULSOUT 1.........
You are actually send a 2ms pulse.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
not to be dinky but its 2 uS "units"...
thanks for the help.
~Jeremy
Different Stamp platforms (BS-2, BS-2SX, BS2p, etc) have different operational speeds. By working with "timer units" in the text, the definitions of all the time related commands can be the same. Tables of timer unit values are always found in the text of the PBASIC command definitions. Then it is up to the programmer/user to determine which Stamp platform they are planning to use, and determine the value of the timer unit and apply it appropriately within the program.
Additionally, since conditional compilation is now available, the programmer could set up a "timer unit template" to plug-in the appropriate constant, as may be required, based on the '{$STAMP } directive (which see). The '{$STAMP ... } directive tells the PBASIC Stamp Editor which Stamp platfom is being used. The values used would come from the published timer unit tables mentioned above.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
The Table found with the Pulsin instruction tells you everything that you need to know. Here is a copy of it:
The BS-2px·timer unit value is .81 µs, and the maximum pulse width is 53.08 ms.
Regards,
Bruce Bates
DEC5 time * 2
becuase the bs2 measures in increments of 2uS,, so if i get a faster stamp would i have to change the code to a more complex formula?
· DEC5 (time */ $CC)
The */ operator allows you to multiply by fractional values (resolution is 1/256).· $C0 = 0.8.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax