Your Serial Device; Sending Dmcc Commands To Dataman Devices; Displaying Static And Live Images From A Dataman Device - Cognex DataMan Communications And Programming Manual

Hide thumbs Also See for DataMan:
Table of Contents

Advertisement

mySystem.Disconnect();
Note: Currently all devices use the user name admin. If no password is required, an empty string can be used.

Your Serial device

Connect to your serial device by performing the following steps:
1. Create a connector to your device:
SerSystemConnector myConn = new SerSystemConnector(PortName, Baudrate);
where PortName and Baudrate are either known serial connection parameters or come from a SerSystemDiscoverer.
2. Create a new DataManSystem instance with the created connector:
DataManSystem mySystem = new DataManSystem(myConn);
3. Call the Connect() method of your DataManSystem instance:
mySystem.Connect();
4. (Optional) Verify if you are connected:
if (mySystem.IsConnected)
5. To disconnect, call
mySystem.Disconnect();

Sending DMCC Commands to DataMan Devices

Use SendCommand () for sending different commands to the reader. For information about available commands, refer to
the DMCC Command Reference.
There is one mandatory parameter for SendCommand () which is the command string itself. There are also two optional
parameters: one for overriding the default timeout for the command and another for passing additional bytes with the
command.
The following is an example for sending a DMCC command.
DmccResponse response = mySystem.SendCommand("GET DEVICE.TYPE");
Note: The response's content resides in the response object's PayLoad property. Also note that no DMCC header
or footer is specified in the command string.
Some functions like SendCommand() or GetLiveImage() also have asynchronous implementations. If you wish to use
these, look for the desired function name with Begin/End prefix. These functions go in pairs; the function with the Begin
prefix returns an IAsyncResult which can be used by the one with the End prefix.

Displaying Static and Live Images from a DataMan Device

To have static images displayed, use DataManSystem.GetLastReadImage () or subscribe for the event ImageArrived to
get images.
To have live images displayed, perform the following steps:
1. Set the reader to live display mode:
mySystem.SendCommand("SET LIVEIMG.MODE 2");
DataMan Application Development
23

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DataMan and is the answer not in the manual?

Table of Contents

Save PDF