![background image](http://html1.mh-extra.com/html/keithley/pio-12/pio-12_user-manual_3969780026.webp)
I
I
I
1
Programming Examples
The examples presented below use the BASIC programming language to
illustrate some of common programming tasks. Line numbers in these
examples were arbitrarily selected; these examples will work with any
valid line numbering scheme.
Writing the Control Register
The following code specifies 300h as the base address of the P10-12, then
configures all of the ports as outputs:
10 B A D D R = & H 3 0 0 ' S p e c i f i e s 3 0 0 h a s t h e
' P I O - 1 2 b a s e I / O a d d r e s s .
20 O U T B A D D R + 3 , & H 8 0 ' S e t s a l l p o r t s t o o u t p u t s .
Basic 110 Operations
The following code performs some basic I/O operations:
30 O U T B A D D R , & H 2 2 ' S e n d s 2 2 H e x t o P o r t A .
40 O U T BADDR + 1 , 9 9 ' S e n d s 9 9 t o P o r t B .
50 P R I N T I N P ( B A D D R + 1 ) ' R e a d s a n d d i s p l a y s
' P o r t B d a t a i n d e c i m a l .
60 P R I N T H E X $ ( I N P ( B A D D R ) ) ' R e a d s a n d d i s p l a y s
' P o r t A d a t a i n H e x .
Reading BCD Data
The following code reads 2-digit BCD (Binary Coded Decimal) data:
30 B C D % = I N P ( B A D D R ) ' R e a d d a t a .
' C o n v e r t t o d e c i m a l .
40 B C D % = ( B C D % A N D & H F 0 ) * 1 0 / 1 6 + ( B C D % A N D & H O F )
Bit Operations
Bit operations can use the Boolean operators OR, AND, XOR, EQV, IMP,
and NOT
4-5
Summary of Contents for PIO-12
Page 2: ...P10 12 User s Guide Revision D April 1994 Part Number 64190...
Page 7: ......
Page 11: ...I I I I I I I 1...
Page 29: ...I I...
Page 37: ...I...
Page 41: ......