' {$STAMP BS2}
' ==============================================================================
'
' File...... Ex17 - FreqIn1.BS2
' Purpose... Frequency input
' Author.... Parallax
' E-mail.... stamptech@parallaxinc.com
' Started...
' Updated... 01 MAY 2002
'
'
' ==============================================================================
' ------------------------------------------------------------------------------
' Program Description
' ------------------------------------------------------------------------------
' This program monitors and displays the frequency of a signal on Pin 0.
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
FreqPin CON 0 ' frequency input pin
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
OneSec CON 1000 ' one second - BS2
' OneSec CON 2500 ' BS2sx
' OneSec CON 3484 ' BS2p
' ------------------------------------------------------------------------------
' Variables
' ------------------------------------------------------------------------------
freq VAR Word ' frequency
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
COUNT FreqPin, OneSec, freq ' collect pulses for 1 second
DEBUG CLS, "Frequency: ", DEC freq, " Hz", CR ' display on DEBUG screen
GOTO Main ' do it again
END