Remote-processing BASIC 52 Bedienungsanleitung Seite 60

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 163
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 59
RPBASIC-52 PROGRAMMING GUIDE
2-41
FREQ (Function)
Syntax: FREQ(channel)
Where: channel = 0 or 1, depending upon card.
Function: Returns a counter value
Mode: Command, run
Use: PRINT FREQ(0)
Cards: RPC-210, RPC-320, RPC-330 (RPC-210 and -320 are channel 0 only)
DESCRIPTION
This command returns a frequency, or number of pulses over a period of time. FREQ returns the latest value
from the hardware counter. FREQ does not actually read from the counter. The operating system reads the
counter at set intervals defined by CONFIG FRE Q and stores them for retrieval by this function. This
function is used to read analog input modules made by Greyhill, Dutec, and others. Equivalent 15+ bit analog
input readings are theoretically possible.
FREQ function returns 0 until set up by CONFIG FREQ.
The latest FR EQ value remains in memory until updated by the RPB ASIC-52 operating system . The update
interval is dete rmined by the CONFIG FRE Q com man d.
Avoid using COUNT(n) when using this command. It is possible values returned by COUNT(n) could be
wrong.
Hardware counters (LSI 7166) are used to count pulses. CONFIG FRE Q defines the time interval between
readings. The operating system reads and resets the counters every time interval. Thus, you can measure a
frequency in 1/10 second. The result is multiplied by 10 to obtain the "true" frequency. Errors in this case
are also multiplied by 10. The best rule is to set the time interval in CONFIG FREQ for as long of a period as
possible (up to 1.275 seconds) to get the most stable and accurate readings. Shorter intervals make counts
appear less stable.
Best resolution is below 80 Khz at a measurement interval of 1/2 second. Between 80 Khz and about 190
Khz counts can easily vary by ±2. From 190 Khz to about 1 Mhz, counts vary by up to ±10. Above 1 Mhz,
counts vary much more. Counting to 20 Mhz is possible.
You will have to play with the m easure ment interval, based on the input fre quenc y and d esired stability.
Averaging the counts helps stabilize the readings.
There are several sources of errors and instability. The time interval between counter readings is based on the
system tick tim er, which is based on the crystal. Accuracy is usually better than 0.01% . The error is very
noticeable at higher (> 200Khz) frequencies. Another potential source of error is the program or functions
you may be executing. Some functions, such as AIN, turn off all interrupts for a "short" period of time (50
micro-seconds). What this means is, if it is time for the operating system to read the counters, the reading
will be delayed by up to 50 micro-seconds. If the frequency is very high, additional counts are read. No
counts are missed, so averaging readings helps to reduce errors.
Counts are missed when the frequency is above 1 Mhz (500 Khz on the RPC-210). This is because of CPU
processing time between latching and reseting the counter (about 1 - 2 micro-seconds). Increasing the time
interval between readings helps to reduce errors but does not eliminate them.
RELATED
CONFIG FREQ
ERROR
Seitenansicht 59
1 2 ... 55 56 57 58 59 60 61 62 63 64 65 ... 162 163

Kommentare zu diesen Handbüchern

Keine Kommentare