![]() |
![]() |
![]() |
||
Model 4000D:
Digital Amplifier
|
|
|||
The SMT 4000D gage amplifier makes a wide range of data available through the serial port. The programmability of applications like Microsoft Excel and Word make it possible to automate setup and data collection using the serial port. This document shows how to automatically gather thickness readings from a 4000D amplifier directly into an Excel spreadsheet. We have supplied the example spreadsheet and supporting system files on floppy disk. System Requirements
Loading the Example
The example spreadsheet is called "4000D Demo.xls." You may either copy this file to your hard disk or run it directly from the floppy. Double click on "4000D Demo.xls." Microsoft Excel should load the spreadsheet and immediately try talking to the amplifier. One of three things will happen at this point. If the amplifier is connected to COM2: and has Òcomputer modeÓ enabled, you will get a message box, "Connected to gage..." Click OK to continue. If you are using a different serial port or if the amplifier is not communicating, you will get an error message. Your computer may be using
another serial port and may not even have a port called COM2:. In that
case you will get a message box, "Can't connect to gage on com2:".
Click on OK, then click on the tab labeled "SMT Gage Driver"
at the bottom of the "4000D Demo.xls" window. You will see
the following VBA code: 'Put the COM port and
baud rate for your gage connection here: Change "com2:" to Òcom1:" or whatever port you are using, close the workbook (or exit Excel) saving changes, and try loading it again. If the serial port is OK but the amplifier does not respond within one second, you will get a message box, "No response from gage." The amplifier may not be in "computer mode," or it may not be connected properly. Remember that you must have a Ònull modemÓ adapter between the computer and the amplifier. To try communicating again, you must close the workbook or exit Excel and load "4000D Demo.xls" again. Running the Example
Changing the Example
Here is how it works.
The "Online Start" menu selection sets "running" to true and calls get_reading. Get_reading does the following:
You can increase the time between readings by editing the TimeValue("00:00:01") in the Application.OnTime line. Other Possibilities Using Excel macros or VBA, you can do many other things with the collected data. You could automatically graph it, compute statistics on it, etc. It is also possible to send data to the gage using the gage_IO procedure. For example you can set the master value to 25.4 microns with gage_IO("P8,254."). You can also use the gage_IO procedure in Visual Basic version 4 or later. Copy the code from the spreadsheet and paste it into a VB code module. Except for get_reading, which refers to the Excel ActiveCell and Application objects, the procedures will work in your VB programs. Feel free to contact SMT for technical support. We can provide tips on using and extending this example or we can quote software development services for more extensive applications.
|
||||
|
||||
|
![]() |