Skip to main content

COUNT

Syntax

COUNT pin, milliseconds, variable

Description

Count the number of pulses low-high-low or high-low-high on pin over a duration of milliseconds, returning the value to variable.

Example

'Report the number of transition cycles on pin 7
during a 10 second interval

COUNT 7, 10000, val

PRINT "Pin 7 transitioned "; val; " times"

Pin 7 transitioned 3 times

'test the operation of the COUNT routine --
attach a 100 KHz signal generator to pin 15

' this uses the > run immediate operator and the . print immediately
operator

>COUNT 15, 10000, x

.x

99630

Differences from other BASICs

  • no equivalent in Visual BASIC
  • none from PBASIC

See also