Chapter 3 Programming Your Universal Counter for Remote Operation

Programming Examples

To Perform a Time Interval Calibration (HP BASIC) (Continued)

440

CLEAR @Count

 

450

OUTPUT @Count;"*RST"

! Reset the HP 53131A

460

OUTPUT @Count;"*CLS"

! Clear event registers and error queue

470

OUTPUT @Count;"*SRE 0"

! Clear service request enable register

480

OUTPUT @Count;"*ESE 0"

! Clear event status enable register

490

OUTPUT @Count;":STAT:PRES"

! Preset enable registers and

500

 

! transition filters for operation and

510

 

! questionable status structures.

520RETURN

530!

540Unsecure: ! Routine UNSECURES the device

550OUTPUT @Count;":CAL:SEC:STAT?" ! Query the current security status

560

ENTER @Count;Device_secure

! Check: SECURED=1, UNSECURED=0

570

WHILE Device_secure=1

! If device is SECURED

580

INPUT "Enter security code to unsecure counter.",Code$

590

OUTPUT @Count;":CAL:SEC:STAT OFF,";Code$ ! UNSECURE the device

600

OUTPUT @Count;":CAL:SEC:STAT?"

! verify it is SECURED

610

ENTER @Count;Device_secure

 

620

IF Device_secure=1 THEN

! On operator error, loop

630PRINT "Wrong code, try again."

640GOSUB Read_errors

650END IF

660END WHILE

670RETURN

680!

690Resecure: ! Routine SECURES the device

700OUTPUT @Count;":CAL:SEC:STAT?" ! Query the current security status

710

ENTER @Count;Device_secure

! Check: SECURED=1, UNSECURED=0

720

WHILE Device_secure=0

! If device is UNSECURED

730

INPUT "Enter security code to secure counter.",Code$

740

OUTPUT @Count;":CAL:SEC:STAT ON,";Code$ ! SECURE the device

750

OUTPUT @Count;":CAL:SEC:STAT?"

! verify it is SECURED

760

ENTER @Count;Device_secure

 

770

IF Device_secure=0 THEN

! On operator error, loop

780PRINT "Wrong code, try again."

790GOSUB Read_errors

800END IF

810END WHILE

820RETURN

830!

840Store_cal: ! Routine collects the calibration data

850 OUTPUT @Count;":CAL:DATA?"

Ask for calibration data

860ENTER @Count USING "#,4A";Head1$ ! Collect the data. Store Head1$ and

870ENTER @Count USING "%,K";Cal_data$ ! Cal_data$ on a disk as your backup

880RETURN

890!

900!

3-70

Programming Guide