Remote-processing BASIC 52 Manual de usuario Pagina 86

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 163
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 85
RPBASIC-52 PROGRAMMING GUIDE
2-67
ON COUNT
Syntax: ON COUNT number, line number, count, program line
ON COUNT number, line number
ON COUNT number
Where: number is 4 to 11. It represents a counter numbe r.
line number is 0-7 or 100-123 and is the digital I/O line number.
count is 1 to 65535. It is the num ber of pulses nee ded for an interrupt.
program line is the subroutine to execute when count is reached.
Function: Enables count multi-tasking at a specific I/O line. Optionally generates a software interrupt when the
specified number of counts at an I/O line is reached.
Mode: Run
Use: ON COUNT 10,7,200,5000 Executes a subroutine at line 5000 when 200 counts are reached at I/O
line 7.
Cards: RPC -320, R PC-330. line number is card dependent. Refer to your hardware m anual.
DESCRIPTION
This command enables software counting. This command is not related to any hardware counters on the card.
The three syntaxes control counting as follows: T he first syntax with all parameters generates a software
interrupt when count is reached. The second syntax simply enables counting at the line number. The third
syntax turns off count multi-tasking for that number only.
A pulse is counted on a high to low transition. A line must be high and low for a m inimum of 5 ms to ensure
detection. The RPBASIC-52 operating system scans the specified lines every 5 ms. Thus, maximum
counting frequency is 100 Hz. In practice, maximum is 95 Hz using a perfect square wave.
The current number of pulses at a counter number is read using the COUNT function. To reset or zero a
count value, re-execute ON COUNT again for that particular number.
number is from 4 to 11 to distinguish it from the other hardware counters on board.
Review HARDWAR E AND SOFTWARE INTERRU PTS in the first part of this manual for interrupt
handling and multitasking information. Read COUNT MULTITASKING earlier in this manual for a summ ary
of operation.
RELATED
COUNT function
ERROR
BAD ARGUM ENT when number is out of range.
EXAMPLE
The following example sets line 0 as a counter and branches to a subroutine when this line is brought low 10
times
10 ON COUNT 4,0,10,1000
20 IDLE
30 GOTO 20
.
.
.
1000 PRINT "Counter 4 interrupt"
1010 RETURN
This example makes line 3 a counter only input. Its value is printed every second using COUNT function.
Vista de pagina 85
1 2 ... 81 82 83 84 85 86 87 88 89 90 91 ... 162 163

Comentarios a estos manuales

Sin comentarios