Appendix b - sample visual basic code, B-1 demo application, B-2 using the demo application – Anritsu 0701012 User Manual

Page 53: Appendix b—sample visual basic code, Appendix b — sample visual basic code

Advertising
background image

MA24106A UG

B-1

Appendix B — Sample Visual Basic Code

B-1 Demo Application

The MA24106A CD contains a demo application that allows you to interface with the power sensor using the
remote programming protocol. The sample code is written in Microsoft® Visual Basic® 6.0 and is given at the
end of this appendix. The complete project, DempApp.vbp, is available on the CD that shipped with the sensor.
The Demo Application’s main form is shown below:

It is recommended to use the source code and project available on the CD that shipped with the sensor to
minimize typing errors. You may need to add Microsoft® Comm Control 6.0 manually, which can be added
from Visual Basic® 6.0 IDE by navigating to: Project | Components.

B-2 Using the Demo Application

Once connected to the PC using the USB cable, the MA24106A shows up as a Serial port device on the PC. You
can check the COM port number using the device manager in the Windows® control panel.
Type the COM port number in the ComPortNo: text box and click Initialize. Once the COM port is initialized,
you can type commands in the Command text box, and then click the Send button. Any responses from the
sensor will be displayed in the Received text box. You can use the Functions group buttons to exercise the
sensor for power readings, frequency readings and settings, and for zeroing sensor.

Figure B-1.

Demo Application

Note: The Demo Application uses Microsoft Comm Control, which limits COM Port number usage to less than 16

(COM3 to COM16).

Advertising
This manual is related to the following products: