Get the SoR Robotics Android App on Android Market for FREE. See this forum post for details.
0 Members and 1 Guest are viewing this topic.
so its basically a $50 board but with no I/O pins on it?
Syntax: PULSIN Pin, State, VariableFunctionMeasure the width of a pulse on Pin described by State and store the result in Variable. Pin is a variable/constant/expression* (0 - 15) that specifies the I/O pin to use. This pin will be set to input mode. State is a variable/constant/expression* (0 - 1) that specifies whether the pulse to be measured is low (0) or high (1). A low pulse begins with a 1-to-0 transition and a high pulse begins with a 0-to-1 transition. Variable is a variable (usually a word) in which the measured pulse duration will be stored. The unit of time for Variable is described below. * Note: Expressions are not allowed as arguments on the BS1. The range of the Pin argument on the BS1 is 0 - 7. Quick Facts BS1 BS2, BS2e, and BS2pe BS2sx, BS2p, and BS2px Units in Variable 10 Ás 2 Ás 0.8 Ás Maximum pulse width 655.35 ms 131.07 ms 52.428 ms ExplanationPULSIN is like a fast stopwatch that is triggered by a change in state (0 or 1) on the specified pin. The entire width of the specified pulse (high or low) is measured, in units shown above and stored in Variable. Many analog properties (voltage, resistance, capacitance, frequency, duty cycle) can be measured in terms of pulse duration. This makes PULSIN a valuable form of analog-to-digital conversion. PULSIN will wait for the desired pulse, for up to the maximum pulse width it can measure, shown in the table above. If it sees the desired pulse it measures the time until the end of the pulse and stores the result in Variable. If it never sees the start of the pulse, or the pulse is too long (greater than the Maximum Pulse Width shown above), PULSIN "times out" and store 0 in Variable. This operation keeps your program from locking-up should the desired pulse never occur.Regardless of the size of Variable, PULSIN internally uses a 16-bit timer. Unless the pulse widths are known to be short enough to fit in an 8-bit result, it is recommended using a word-sized variable. Not doing so may result in strange and misleading results as the BASIC Stamp will only store the lower 8-bits into a byte variable.