Register-Based Programming 85
Appendix B
Programming Examples
This section provides example programs in BASIC and C/HP-UX, including:
•
Example: Reading the Registers (BASIC)
•
Example: Reading the Registers (C/HP-UX)
•
Example: Making Measurements (BASIC)
•
Example: Making Measurements (C/HP-UX)
•
Example: Scanning Channels (BASIC)
•
Example: Scanning Channels (C/HP-UX)
Example: Reading
the Registers
(BASIC)
This BASIC programming example reads the Manufacturer ID Register,
Device Type Register and Status Register on the Form C switch.
10
!*****************************************************
20
! ****** READREG *****
30
!*****************************************************
40
OPTION BASE 1
50
!
Set up arrays to store register names and addresses
60
DIM Reg_name$(1:3)[32], Reg_addr(1:3)
70
!
80
!
Read register names and addresses into the arrays
90
READ Reg_name$(*)
100
READ Reg_addr(*)
110
!
120
!
Set base address variable
130
Base_addr = DVAL("DE00",16)
140
!
150
!
Map the A16 address space in the controller
160
!
170
CONTROL 16,25;2
180
!
Call the subprogram Read_regs
190
Read_regs(Base_addr, Reg_name$(*), Reg_addr(*))
200
!
210
DATA Identification register, Device register, Status register
220
DATA 00, 02, 04
230
END
.
.
.
300
!
This subprogram steps through a loop that reads each register
310
!
and prints its contents
320
SUB Read_regs(Base_addr, Reg_name$(*), Reg_addr(*))
330
!
340
For Number = 1 to 3
350
Register = READIO(-16,Bas Reg_addr(number))
360
PRINT Reg_name$(number); " = "; IVAL$(Register,16)
370
Next Number
380
SUBEND
Summary of Contents for E1463A
Page 2: ......
Page 6: ...6 Notes ...
Page 10: ...10 Notes ...
Page 78: ...78 Form C Switch Specifications Appendix A Notes ...
Page 98: ...98 Index Notes ...