background image

 

Programming interface 

 

4.2 Error and status messages 

SIMATIC 3964R protocol for Windows 9x/XP/7 
Installation Manual, 01/2013, J31069-D0131-U001-A2-7218 

23

 

4.2

 

Error and status messages 

Messages returned by the functions described in the previous section can be divided into 

three classes:  
●  Positive status messages 
●  Status error messages 
●  System error messages 
The following error codes are defined in the header file "3964r.h". 

Positive status messages 

 

Used by: 

 

ComReadState 

 

ComWriteState 

The status messages are returned when: 
●  an operation was completed successfully 
●  an event was not evaluated as an error 

 

Status messages 
COM_ST_FREE 

Everything OK, no job present 

COM_ST_BUSY 

A job is currently being processed, no error has occurred up to now. 

COM_ST_SUCCESS 

The last operation was completed successfully. 

Summary of Contents for SIMATIC Ident

Page 1: ...__ ___________________ ___________________ ___________________ SIMATIC Ident RFID systems SIMATIC 3964R protocol for Windows 9x XP 7 Installation Manual 01 2013 J31069 D0131 U001 A2 7218 Introduction 1 Installation 2 Parameter assignment 3 Programming interface 4 ...

Page 2: ...be operated only by personnel qualified for the specific task in accordance with the relevant documentation in particular its warning notices and safety instructions Qualified personnel are those who based on their training and experience are capable of identifying risks and avoiding potential hazards when working with these products systems Proper use of Siemens products Note the following WARNIN...

Page 3: ...nctions 6 1 2 System requirements 6 2 Installation 7 2 1 Installing the driver 7 2 2 Adapting the registry 9 2 3 Linking in the header file 9 2 4 Linking in the library file 9 3 Parameter assignment 11 4 Programming interface 13 4 1 Functions of the serial interface 13 4 2 Error and status messages 23 4 3 Linking the driver into your own programs 26 ...

Page 4: ...Table of contents SIMATIC 3964R protocol for Windows 9x XP 7 4 Installation Manual 01 2013 J31069 D0131 U001 A2 7218 ...

Page 5: ...D systems To install the driver you need to know the Windows version being used Windows XP or Windows 7 To program applications you need to be familiar with the programming languages listed below The 3964R driver is implemented as a DLL file To configure the driver functionality there is also an application for the Control Panel in the form of a CPL file You will find the installation files on the...

Page 6: ...parallel to each other Transmission rate 300 baud to 256000 baud 7 or 8 data bits 1 1 5 2 stop bits Parity freely selectable The number of send and send start repetitions can be selected Buffer size send receive can be set in each case up to 65536 bytes Timeout times for 3964R Lauf can be selected 1 2 System requirements The software was tested with the following hardware Operating the driver in a...

Page 7: ...find the installation files on the DVD RFID Systems Software Documentation order number 6GT2080 2AA20 Follow the steps below to install the driver 1 Start the setup program by double clicking on the MOBYAPI MSI or SETUP EXE file in the DVD folder daten Moby_lib MOBY_API Figure 2 1 Setup program MOBY API 2 Follow the instructions of the setup program ...

Page 8: ...for the current user Just me or for all users Everyone Figure 2 2 Selection of the user group 4 Click the Next button to install the driver 5 Once the driver has been successfully installed click the Close button to exit the setup program Figure 2 3 Installation successfully completed After successful installation of the driver the entry 3964R Lauf is created in the Control Panel ...

Page 9: ...der file If you want to use the function library for program development you will need to link the header file into the development project If you keep to the default installation are when installing the driver the header file is stored in C Program Files Mobyware include File name in the header file 3964R H 2 4 Linking in the library file If you want to program your own applications you will need...

Page 10: ...Installation 2 4 Linking in the library file SIMATIC 3964R protocol for Windows 9x XP 7 10 Installation Manual 01 2013 J31069 D0131 U001 A2 7218 ...

Page 11: ...auf is created in the Control Panel Follow the steps below to make settings for the freely selectable interfaces and protocols 1 Start the configuration program by double clicking on the 3964R Lauf file in the Control Panel Figure 3 1 Configuration of the COM ports of the 3964R protocol A maximum of four COM ports can be configured Each of the four COM ports can be assigned a name to suit your pur...

Page 12: ... Otherwise only the data that does not relate to interface parameters will be adopted e g timeout times 5 Click OK to apply your changes By clicking the Reset button you reset the parameters to the values that were valid when the configuration program was called By clicking the Default button you reset the parameters to the original data written to the 3964R as default The maximum length for the s...

Page 13: ...s function is used to open an interface and to prepare for data transfer It must be called before all other functions Parameter com_name Interface name as string Possible values COM1 COM255 a maximum of 4 COM ports can be open at the same time read_number Size of the receive buffer in bytes write_number Size of the send buffer in bytes hwnd Windows handle as destination for the notification messag...

Page 14: ...y the total of the lengths of all buffered frames ComRead comInt ComRead int com_handle void read_data int read_number long options This function is used for the blocking receipt of frames Parameter com_handle interface handle from ComOpen read_data Pointer to the receive buffer of the caller read_number Length of the receive buffer options Not used Return value 0 Number of bytes read frame length...

Page 15: ...d buffer of the caller write_number Length of the send buffer options Not used Return value 0 Number of bytes written frame length 0 possible error message COM_HANDLE_FALSE COM_2SMALL COM_WRITE_ERROR Notes This call places the send job in a send buffer The actual data communication is asynchronous As result the return following the call for this routine simply means that the send job was correctly...

Page 16: ...dows message is sent to the window with the handle from ComOpen with the message ID msg The data of this message can be queried with the help of COMGetNotify The user_id is sent with every message for simpler message identification user_id and msg are used only for the events specified in this call By calling the COMEnableEvent function several times it is therefore possible to combine various mes...

Page 17: ...n Parameter wParam wParam parameter of the incoming message lParam IParam parameter of the incoming message user_id Pointer to storage space for the ID assigned by the user when calling COMEnableEvent event_ptr Pointer to the storage location for event type state_ptr Pointer to the storage location for the status of the completed operation that triggered the message handle_ptr Pointer to storage l...

Page 18: ...e callback routine userID User defined ID any value Return value 0 Function successfully completed 0 possible error message COM_HANDLE_FALSE ComGetReadState comInt ComGetReadState int com_handle This function queries the current status of the receive routine and then resets it Parameter com_handle interface handle from ComOpen Return value COM_ST_FREE Receive routine is not busy COM_ST_BUSY A fram...

Page 19: ...y 0 Error status Notes If the current status is COM_ST_BUSY the status is not reset The error status can include several errors at the same time Each bit in the error number corresponds to an error The COM_ST_ERROR is set in any case Section Error and status messages Page 23 contains a precise description of the individual errors ComClose comInt ComClose int com_handle This function closes an inte...

Page 20: ...otes The current version returns the value 450 for version 4 50 and the following expanded version string 3964R Lauf for Windows 95 NT XP 7 version 4 50 November 2012 The transferred buffer area should have a minimum size of 100 characters ComString comInt ComString char errs int error int typ This function returns an error text for the transferred error value Parameter errs Buffer for error text ...

Page 21: ...0 characters ComReadConfig comInt ComReadConfig LPCSTR devName devConfig_p conf This function reads the configuration data for a specified port from the registry and returns it in an edited form The port does not need to be opened Parameter devName Interface name as string possible values COM1 COM255 conf Pointer to configuration variable Return value 0 Function successfully completed 0 possible e...

Page 22: ...e registry The port does not need to be opened Parameter devName Interface name as string possible values COM1 COM255 conf Pointer to configuration variable force Force the immediate adoption of the configuration Return value 0 Function successfully completed 0 possible error message COM_REGISTRY COM_NO_CONFIG Notes If the force parameter is set to TRUE the configuration data is adopted immediatel...

Page 23: ...tatus messages Status error messages System error messages The following error codes are defined in the header file 3964r h Positive status messages Used by ComReadState ComWriteState The status messages are returned when an operation was completed successfully an event was not evaluated as an error Status messages COM_ST_FREE Everything OK no job present COM_ST_BUSY A job is currently being proce...

Page 24: ...ROR is always set The following status error messages are possible Status error messages COM_ST_2MANY Too many jobs send queue full COM_ST_NO_CON Connection establishment failed sending COM_ST_NO_TRA Frame transfer failed sending COM_ST_2SMALL Receive buffer too small when receiving COM_ST_BCCERR Block check error while receiving COM_ST_TIMCON Timeout during connection establishment sending COM_ST...

Page 25: ...subset of the error messages listed in the header file All the relevant error messages are listed below System error messages COM_HANDLE_FALSE Transferred handle is invalid COM_ALREADE_OPEN Interface is already open COM_DDFINI_ERROR Interface initialization error COM_NO_MEMORY Not enough memory available COM_2SMALL Buffer overflow COM_READ_ERROR Bad receive job COM_WRITE_ERROR Bad send job COM_UNK...

Page 26: ... in your own programs note the following two steps The 3964R H header file must be linked into your own source code using the include preprocessor command This declares all function calls and constants The actual library 3964R LIB must be also linked in when linking The header file was developed with and for Visual C from Microsoft If you want to use a different programming language or a C dialect...

Reviews: