Remote-processing RPC-30 Manual de usuario Pagina 23

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 38
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 22
CHAPTER 6 DIGITAL AND OPTO PORTS
RPC-30 Page 21
The program below takes 1,000 samples and stores it in
an array. The time to read and store 1,000 samples is 2
seconds, or 2 ms per sample.
10 DIM F(1000)
20 FOR X = 0 TO 999
30 F(X) = AIN(1)
40 NEXT
Some applications require that measurements be made at
fixed intervals. T he ON TICK construct can be used to
take samples at timed intervals. The program below
reads 2 channels every second and stores it into an array.
When the array fills, the tick timer stops.
10 DIM F(800,2)
20 ON TICK 1 GOSUB 100
30 ..This is a dummy loop
40 GOTO 30
100 F(I,0) = AIN(0)
110 F(I,1) = AIN(1)
120 INC I
130 IF I = 800 THEN ON TICK 1 GOSUB
140 RETURN
The AOT statement outputs to a module. T he number is
in the range of 0 to 4095. The value of the output from
the G5 module is in proportion to the number.
To output to a G5 module, execute the following
command:
1000 AOT slot,value
slot ranges from 100 to 123 and corr esponds to the
number on an external opto rack. value ranges fr om 0 to
4095. The inter nal opto rack cannot be used for output.
Converting analog measureme nts
Input readings can be converted to usable units of
measurement by performing scaling calculations in the
program. The AIN function retur ns values fr om 0 to
511. To change these reading to other units, use the
following calculation:
variable = K * AIN(slot)
K is a scaling constant. It is obtained by diving the
highest measurement unit number by 511.
Example:
You want to measure a 0 to 200 PSI pressure
transducer with a 0 to + 5 volt output. Divide 200
by 511 to obtain the value of K.
K = 200 / 511
K = .3913894
To obtain the final value for the equation in PSI:
V = .3913894 * AIN (n)
DIGITAL I/O PORT
Digital I/O lines on the RPC-30 is supplied by an 82C55
chip. The chip' s lines go to connector J3.
Add 100 to CAM BASIC LINE and OP TO state ments to
access an individual port. For example, line 3 on the
STB boar d is accessed a s LIN E 103, ON. Opto module
position M7 is accessed as OPTO(107).
The lines on J3 are divided into 3 eight bit gr oups. Ports
A and B can be configured as all inputs or outputs. Port
C can be progr amed a s one group of 8 inputs or outputs
or as two groups of four lines (upper and lower C ). The
four lines in upper and lower C can each be programmed
as all inputs or outputs.
When a line is configured as an output, it can sink a
maximum of 2.5 ma at 0.4V and 15 ma at 1.0V.
The address for port A is 0, B is 1, and C is 2. The
CONFIG PIO statement is used to configure the 8255
lines. Use an address of 0.
Port B is connected to a high current sink through U1.
See "High current output" later in this chapter.
Pull up / down resistors
Digital I/O lines at J3 m ay be pulled up to + 5 volts or to
ground through a 10K resistor pack using jumper W6.
Jumper W6 for pull up or down configuration is as
follows:
[1-2] Pull up
[2-3] Pull down
Setting W6 for pull up makes interfacing to switches and
"open collector" TTL devices easy . See "Inter facing to
Switches and other devices" below.
Vista de pagina 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 37 38

Comentarios a estos manuales

Sin comentarios