COUNT Instruction
Syntax: COUNT Pin, Period, Variable

The count instruction is used to count the number of cycles on a specified Pin for a specified Period and have the cycles stored in a Variable.

Stamp Version dependent information needed to determine the constant from (1 - 65535) to specify the period.

  BS2 BS2p
Units In Period 1ms 287uS
Max. Frequency 120,000 Hz 416,700 Hz

Examples:
COUNT 5, 1000, myVar // using a BS2 - would store the number of cycles in one second into myVar
COUNT 5, 3484, myVar // using a BS2p - would store the number of cycles in one second into myVar

Note: the 3484 comes from 1s / 287uS = 3487 and for the BS2 1s/1ms = 1000

So, the equation for determining the constant for period is:
    Period = Time Desired (in secs) / Units In Period (in secs)

Below is my source code for a frequency counter that displays the frequency on a HD44780 compatible LCD.  The program waits for an active low button to be pressed and then samples the frequency.

freqcount1.bsp