Remote-processing CAMBASIC Manual do Utilizador Página 193

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 208
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 192
Event Multitasking - 4
Theoretically, a 100 Hz square wave can be counted. However, due to sample timing variations (dependent upon other
multitasking events), the maximum square wave frequency rate should be 80 Hz. To obtain the full frequency response,
the minimum time the signal is low or high is 8 mS. The software is written to reject high frequency noise.
Defining a Counter
Setting up a counter is done with the CON FIG C OUN T statement. The syntax is:
CONFIG COUNT counter, address, bit [,preset] [,AUTO]
Where:
counter is the counter number which may be 0 through 7.
address is the I/O address o f the port (of 8 bits) that you want to use for the input. This will
typically be an 82C55 po rt.
bit is the particular bit or line of the port addressed. The range is 0 through 7.
preset is an optional parameter that tells the counter to notify the system when a preset count has
been reached. The program will branch if an ON COUNT statement has been executed. The value
may range from 1 to 65,656.
AUTO is an optional parameter. W ithout AUTO, the counter will continue to increment after the
preset count is reached. When AUTO is specified, the counter will reset to zero after reacting the
preset count. This way no counts are m issed while the subroutine branch is executing.
Background Tasking is Much Faster
The data that you enter with the CONF IG COU NT and ON COUNT statements is compiled into object code. Thus, the
execution time on the 200 Hz (100 times in 9 MHz systems) clock tick is only microseconds, rather than the milliseconds
that it would take in BASIC.
Modes of Oper ation
At there are tw o modes of opera tion. T he first is the polled mode in which counts are ac cumulated and read from time to
time by the program. When the counter reaches 65, 535, the next count will roll the counter over to zero. This mode
requires only that CONF IG COUN T and START C OUNT be executed in that order. A short example would be:
10 CONFIG COUNT 5,0,1,2000,AUTO
20 START COUNT 5
.
.
Line 10 configures counter 5 to read bit 1 of address 0 as an input. When the count reaches 2000,
the counter will automatically rese t.
Line 20 starts counter operation. These two lines do not need to be adjacent in the program.
However, line 20 must be executed after line 10.
Vista de página 192
1 2 ... 188 189 190 191 192 193 194 195 196 197 198 ... 207 208

Comentários a estes Manuais

Sem comentários