Programming Notes4; Interpreted Basic4; I/O Commands - Keithley PIO-12 User Manual

Hide thumbs Also See for PIO-12:
Table of Contents

Advertisement

The following code sets Bit 3 on Port A to 1 without disturbing the other
bits:
30 A % = I N P ( B A D D R )
40 O U T B A D D R , ( A % O R 2 ^ 3 ) ' O R b i t 3 a n d w r i t e t o
The following code clears bit 7:
30 A % = I N P ( B A D D R )
40 O U T B A D D R , ( A % A N D N O T ( 2 - 7 ) )
The following code illustrates the use of the BASIC WAIT command to
wait for a particular condition on Port C:
30 W A I T BADDR + 2 , N % , J %
The result of an XOR on the data read at Port BADDR +2 (Port C in this
example) and J% is ANDed with N%. If the result is zero, the program
loops back and reads the port again; otherwise execution continues with
the next line.
Programming Notes
The following subsections discuss some of the factors you should
consider when programming the P10-12.
Interpreted Basic
Programs written using Interpreted BASIC are relatively slow in
executing I/O statements. Compiling these programs usually decreases
the execution time dramatically.

I/O Commands

Most high-level languages include port I/O commands. Fortran, however,
does not have built-in I/O commands. Fortran users will have to resort to
4-6
P
r
o
g
r
' R e a d
p o r t A .
' P o r t A .
' R e a d
p o r t A .
'AND t h e i n v e r s e o f b i t 7 ,
' e f f e c t i v e l y m a s k i n g i t
' t o a n O F F s t a t e .
a
m
m
i
n
g

Advertisement

Table of Contents
loading

Table of Contents