This is a sticky question.
COUNT makes the pin you select an input, watches for 0-1-0 transitions, and counts each one it sees. The time out you specify (1000 in your example) means 1000 milliseconds, or one second. An interrupt is used to track this time-out. COUNT
only works on one pin at a time. If you did this in assembly, you may do more than one at a time, but you are limited by the number of timers available, which is usually two or three for a typical processor.
If you are measuring known, constant signals, like a clock, then you can get around this by using
Code:
COUNT P0, 100, VAR1
That is, measuring for 100 milliseconds, a tenth of a second. You can do eight samples in a row in 800 milliseconds, so you finish in under a second. When done, multiply the variables by 10 to get the final frequency, with tiny inaccuracies.
If your signals are irregular, and you have to sample eight signals, this doesn't work.
There are hardware solutions, like using eight sets of flip-flop ICs, clocked by the external signals of interest. This looks like:
1. Reset the F/F outputs to all zeroes (F/F = Flip-Flop)
2. Enable the F/F clock inputs
3. Start a 1 second timeout in your Atom. When that finishes, you
4. disable clocking of the F/Fs and
5. read the values at the outputs of the F/Fs and store them to variables.
6. Start all over again with 1.
This is a simplistic description. Kindly do not ask for a detailed description and diagram. I only advise and suggest. Try Googling for counter circuits.
Another hardware solution is using any Count/Compare registers (usually called CCP) built into the Atom. Once again, you are limited by having a small number of these registers. This is a matter of coding in assembly after studying the data sheet for the processor. If you're new to processors, this is a daunting task.
Next thing, try this question at the Atom/Pro forum at lynxmotion.com. The people there are very knowledgable about these chips. Or email Basic Micro's
support@basicmicro.com.
Take care,
kenjj