A Device Profile defines the settings needed to communicate with one type of device on a particular COM port.
In the Properties for a Numeric Input test, click the ellipsis button for the DeviceProfile property. Then choose a Device Profile from the list and click Select.
Clicking Select also saves changes to the current Device Profile and selects it for the current Numeric Input test.
To remove the Device Profile from the Numeric Input test and return to keyboard-only entry, select the Device Profile <<None>> at the top of the list. Alternately, you can use the BACKSPACE key or DEL key to clear the text of the DeviceProfile property.
Click the New button and enter a descriptive name for the Device Profile.
In the Serial Port Setup area, choose a COM port and communication settings.
You can either use the System Port Settings (computer settings for the selected COM port – configured in the Control Panel, Device manager) or set the Manual Configuration area to match the communication settings documented for your RS-232 device. To add a delay between opening the COM port and beginning communication tasks, set the Open Delay.
Use the Testing area to verify that your device can communicate with the computer:
Click Connect to begin communication via the selected COM port.
Then get one or more test readings:
Press a button or footswitch on the device to send data to the computer
Type a device command (from your device documentation) in the Test Write box and then click the Test Write button
If your device is configured to send a continuous stream of data, that data will be displayed immediately
If your device sent data to this COM port before you clicked Connect, it will be displayed immediately.
Tips:
If this generates an error that the port does not exist, you must either change the COM port mapping on the PC or update the Device Profile to the new port number.
If you need to troubleshoot communication with an attached device, close the GainSeeker Inspections module and use the ComTestSerial serial test communications program (free to download from the internet and free to use) to verify reliable communication between the device and the computer.
If you need to emulate communication from a device that is not currently available, you can use the com0com null-modem emulator (free to download from the internet and free to use) that creates a pair of connected virtual COM ports. You can then use GainSeeker to communicate with one of those virtual COM ports and ComTestSerial (above) to communicate with the other port.
This step takes place on the Profile Setup tab.
With Profile Mode set to Normal, you can easily configure additional settings for reading RS-232 input strings, writing output strings, extracting your data value from the input string, and prompting the inspector for readings.
Same as the Test Write box above, but stored in the Device Profile and used when the inspector (or a Python script) triggers a reading from the device.
If your device is configured to send a continuous stream of data, this configures the Device Profile to first clear the input buffer for the specified COM port, and then process the first reading after the buffer was cleared.
If the input string from your device contains more than just the measurement value (like the Testing example above), first designate whether the values in that input string can be separated into "columns" by commas or spaces.
Then indicate which column contains your measurement value. (Empty columns are ignored when counting the columns.)
Note: The Column Index begins numbering at 0. So the first value in the string is column 0, the second value is column 1, etc.
On the Prompt tab, you can set the label for the spinner window - and optional Prompt window - that is displayed to the inspector.
When the Inspection is waiting for the device to send a reading, a spinner window will be displayed.
With Profile Mode set to Normal, you can customize the spinner window with your own Prompt text. This can include placeholders {{{subgroup}}} (which measurement in the subgroup - 1, 2, etc.), {{{partno}}} (name of the SPC standard), and {{{descript}}} (Description of the SPC standard).
For example, the Prompt text Take reading {{{subgroup}}} for {{{partno}}} will display a spinner window like this during data entry:
When Profile Mode is set to Advanced, you can customize the spinner window by adding serial[x].message to the Custom code.
Additionally, you can display a Prompt window that waits for user interaction before triggering any communication with the device and displaying the spinner window. This applies to both Normal and Advanced profile modes. (You might want to do this if you want the inspector to click a button before writing to the device, for example.)
To display this Prompt window, select the Show Prompt window check box. To make the Prompt window smaller, you should also select the Use Smaller Prompt Size check box.
The Prompt text that you entered for the spinner window will also be displayed on this Prompt window, like this example of the smaller prompt:
GainSeeker 9.4 and previous display a prompt window if there are values in both Write to Device and Prompt. Editing a device profile that was created in one of these previous versions will automatically clear the Show Prompt window check box if either settings is blank or select the check box if both settings contain values. |
When enabled, this setting allows the user to temporarily switch to Keyboard input by pressing CTRL+K at this type of prompt:
The prompt then changes to look like this:
At this Keyboard Input prompt, the user can type a measurement, press CTRL+K to change back to RS-232 mode, enter an asterisk ( * ) in place of a missing measurement, or click Cancel to pause data entry.
On the Device Profile window, click Get Result to see how (and if) your settings will work.
If you see a prompt like the one below, use your device or other hardware (such as a footswitch) to send a reading to the computer.
If the expected reading does not display above the Get Result button, you may need to change your settings or use the Debugger and the Advanced profile mode.
If this generates an error that the port does not exist, you must either change the COM port mapping on the PC or update the Device Profile to the new port number.
The debugger can sometimes help to identify exactly which part of the generated script is not working properly. It can also show you a script that is very similar to the Python code that will be used during data entry.
To use it, select the Show Debugger check box and then click Get Result. This should open a debugger window and allow you to Step through the code or copy the generated script (e.g., for pasting into a script in Advanced profile mode).
For more information on using the Debugger, see Debug Python Scripts in GainSeeker.
Setting up your Device Profile with Profile Mode set to Normal will create a basic, functional script for interacting with your serial equipment.
If you wish to customize the script, change the Profile Mode to Advanced.
This provides a window where you can enter custom Python code that will be used for this Device Profile.
This window displays
an initial block of code that will automatically be run once when the Device Profile is first used in an inspection. You cannot edit this first code block.
a section of Custom code that will be executed for each
measurement.
One suggested (default) line of code is entered when you first
create the Device Profile, but you can customize this code as
desired.
Please note:
This script must set the special variable result.
The only GainSeeker Python commands that can be used by a Device Profile script are the Serial Port commands and the File commands.
The Device Profile script runs in a different scope than the Inspection script. If you need to pass strings or numbers between the two scripts, use the serial.persist command.
If the Prompt tab is set to Show Prompt window, that prompt window will display before the Advanced Profile script is run. You can use the Prompt tab to set the text for that prompt window.
a final block of code that will automatically be run once when the inspection window closes or when the list of inspections or planned inspections is displayed. You cannot edit this last code block.
When you export an Inspection that uses a Device Profile – either from the GainSeeker Inspections module or from the GainSeeker Utility module – the resulting export file will contain both the Inspection and the Device Profile.
When you import an Inspection that uses a Device Profile, both items will be imported. If another Device Profile with that name already exists, GainSeeker will back up the original Device Profile and import the new one.