User Tools

Site Tools


user_manual:com_port

Switch to English Wechseln zu Deutsch Switch to Italian

Communicating with Hardware Controllers

Since version 2.3/2.4, DAVID is able to send/receive commands to/from external devices using a (virtual) COM port. This feature is meant for e.g. moving the laser by a controller-driven stepper motor or for remotely controlling DAVID.

Activating this Feature in DAVID

DAVID 2.x: Open the Advanced Settings, navigate to CommunicationCOM and set the value PortName to the name of your COM port, e.g. COM1.

DAVID 3.x: Open the Advanced Settings, navigate to CommunicationCOM and check “Enabled”. Then close the Advanced Settings window, and select the COM port in the Hardware Setup menu.

Sending Messages

DAVID will send short messages (as text - string or single character) in certain situations. You can define what to send in the Advanced Settings under CommunicationCOMMessages.

  • Close: The string defined here will be sent when DAVID is closed.
  • ModeCalib: Will be sent when you navigate to the Calibration dialog.
  • ModeScan: Will be sent when you navigate to the Scan dialog and choose the upper “Show camera image” toggle.
  • ModeTexture: Will be sent when you prepare to grab a texture (choose the lower “Show camera image” toggle.
  • Open: Will be sent when DAVID is started.
  • StartScanning: Will be sent when you click “Start”, directly after the Reference Image has been grabbed, immediately before scanning starts.
  • StopScanning: Will be sent when you click “Stop”.
  • ScanSaved: Will be sent after you have saved the scan to a file or forwarded it to ShapeFusion (as an indicator that this scan is completed and a new scan will begin).
  • and more, see the descriptions in the Advanced Settings.

You can set the value Newline if you want DAVID to append a certain character to each message (e.g. Byte value 10 for Line Feedback, 13 for Carriage Return, etc., see any ASCII table). Please note: This setting is different from the above “Message” settings. When you enter “13” here, DAVID will append a single byte (value 13). When you enter “13” in one of the Message settings above, DAVID will send two bytes: “1” (ASCII code 49) and “3” (ASCII code 51). Additionally you can include a “\r” in the Message strings; each \r will be replaced by the newline character.

As a simple alternative, you can use the DTR pin as a boolean output. If you set UseDtrDuringScan to 1, DAVID will set the pin high when scanning starts and low on stop. If you set the value to 2, DAVID will send a rect signal synchronized to image grabbing and analysis. You can e.g. make a step with your laser motor each time the signal goes up. Please note that the moment the pin goes low is when DAVID grabs the latest image, not when the camera sensor is actually exposed. To synchronize laser steps and camera images, you may want to set a delay in LaserscannerMinDelayBetweenFrames and set LaserscannerLaserPlaneCalculationLaserMotionEstimationMotionBase to 2.

Receiving Commands

To control DAVID remotely, you can send string commands. This works only on the scan page, when the camera is correctly calibrated! The commands are defined in the Advanced Settings under CommunicationCOMCommands. See the description there for details. Note: You must send a newline (\n or \r, resp. byte 10 or 13) after every command!

Furthermore, if you set the value ScanWhenDcdIsHigh to True, DAVID will start scanning when it receives a positive signal on the DCD pin, and stop when the signal gets negative.

user_manual/com_port.txt · Last modified: 2015/02/13 14:22 by sven