Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual
Page 61

RPBASIC-52 PROGRAMMING GUIDE
2-42
BAD DATA
When channel is out of range for a card.
EXAMPLE
The follow ing exam ple sets up frequen cy multitaskin g and prints the co unts received in a time interval.
10 LINEB 6,1,32
20 LINEB 6,1,72 : REM Reset counter and enable inputs
30 CONFIG FREQ 0,200 : REM Get count every second (5 ms * 200)
40 C = 5/56000 : REM Constant using Greyhill module. 5V / 56000Hz = V/Hz
50 CLEAR TICK(0)
60 IF TICK(0) < 1 THEN 40 : REM Wait for a second
70 A = FREQ(0) : REM Get frequency
80 V = (A-14400) * C : REM Multiply by constant to get Voltage
90 PRINT "Voltage = ",V, "Frequency =",A
100 GOTO 50
You may need to add a 1K ohm pull up resistor from the output of the Greyhill module to the input of the
counter. The inp ut rise time shou ld be 1 micro -second or faster.