background image

DELIB API reference | Seite

53

4.2. Error handling

4.2.1. DapiGetLastError

Description

This function returns the last registered error.

Definition

ULONG DapiGetLastError();

Parameters

None

Return value

Error code
0=no error. (see delib.h)

Example program

ULONG error;

error=DapiGetLastError();

if(error==0) return FALSE;

printf("ERROR = %d", error);

Содержание USB WATCHDOG STICK

Страница 1: ...Hardware Description März USB WATCHDOG STICK 2016 ...

Страница 2: ... BTX Adapter cable 15 2 5 1 2 2 Connection direct to power supply 3 Software 17 3 1 Watchdog Configuration Utility 17 17 3 1 1 Introdcution 18 3 1 2 Configuration 20 3 1 3 Retrigger Software 3 2 Integration of the DELIB 21 21 3 2 1 Integration of the delib h in Visual C C 24 3 2 2 Integration of the delib cs in Visual C 25 3 2 3 Integration of the delib cs in Visual C unter Windows 64bit 29 3 2 4 ...

Страница 3: ... 1 1 DapiOpenModule 48 4 1 2 DapiCloseModule 49 4 1 3 DapiGetDELIBVersion 50 4 1 4 DapiSpecialCMDGetModuleConfig 52 4 1 5 DapiOpenModuleEx 4 2 Error handling 53 53 4 2 1 DapiGetLastError 54 4 2 2 DapiGetLastErrorText 4 3 Watchdog functions 55 55 4 3 1 DapiWatchdogEnable 56 4 3 2 DapiWatchdogDisable 57 4 3 3 DapiwatchdogRetrigger 4 4 Example program 58 5 Appendix 61 5 1 Revisions 61 5 2 Copyrights ...

Страница 4: ...I Introduction Seite 4 Introduction ...

Страница 5: ...evelopment Therefor we can offer you high quality products at a competitive price Availability Because of the modular design of our products we have to redesign only a module instead of the whole product in case a specific component is no longer available 1 2 Customer satisfaction Our philosophy a content customer will come again Therefor customer satisfaction is in first place for us If by any ch...

Страница 6: ...II Hardware description Seite 6 Hardware description ...

Страница 7: ...eriodic intervals by the PC via the USB bus If a timeout occurs the watchdog will switch independently both relays with a procedure which is specified by the user In case of a timeout the relays if correspondingly wired are able to e g reset the PC an external SMS modem can send warnings or a connected horn can alarm The provided test program and a configuration tool facilitate a simple start ...

Страница 8: ...Hardware description Seite 8 2 1 Overview screen ...

Страница 9: ...ck output modul with USB 2 0 USB 1 1 interface Micro controller monitoring 10ms to 10h timeout time adjustable Windows Watchdog API 2 Relays for switching procedures Connection cable ca 1 8m with DSUB 9 connector Dimensions 84 5 21 12 5 9 5 mm without cable ...

Страница 10: ...6 Relay 2 1 4 5 8 9 NC 2 4 Control LED The LED on the watchdog stick displays following status Description LED Flash Sequence Watchdog Disabled LED permanent on turns shortly off by PC access Watchdog Enabled 1 on long pause Watchdog Retrigger 1 on long pause Watchdog Timeout 2 short on long pause ...

Страница 11: ... via Reset Button If the PC is not equipped with a Reset Button you have to reset the PC directly via power supply Therefore the connection cable between the power supply and mainboard has to be cut trough and connected to the Watchdog Stick There are the following connectivity options Connection via ATX BTX Adapter cable Connection direct to power supply ...

Страница 12: ...atchdog Stick Approach 1 Disconnect the main power plug of your power supply 2 Install the D SUB Slot Card in the PC 3 Connect the Watchdog Stick USB side with the USB Slot 4 Connect the Watchdog Stick D SUB side with the D SUB Slot Card A 5 Cut trough and strip the Reset Button Connection Cable between Reset Button and the mainboard Finally connect the both cables with the 1 relay of the D SUB Sl...

Страница 13: ...e PC is not equipped with a Reset Button you have to reset the PC directly via the power supply Therefore you have to disconnect the power supply plug from the mainboard and connect this plug to the slot side of the DEDITEC ATX20 24 Connection Cable optional accessory for the Watchdog Stick After this connect the plug of the DEDITEC ATX20 24 Connection Cable to your mainboard Connect the both late...

Страница 14: ... power supply plug from the mainboard and connect this plug to the slot side of the DEDITEC ATX20 24 Connection Cable optional accessory for the Watchdog Stick After this connect the plug of the DEDITEC ATX20 24 Connection Cable to your mainboard Connect the both lateral protruded wires with the 2 relay of the D SUB Slot Card B Regard the correct connection and the labels of the relays respectivel...

Страница 15: ...power supply 2 Install the D SUB Slot Card in the PC 3 Connect the Watchdog Stick USB side with the USB Slot 4 Connect the Watchdog Stick D SUB side with the D SUB Slot Card A 5 Disconnect the power supply plug rectangular 20 24 pol plug from the mainboard Cut trough and strip the PS_ON wire of the power supply wire harness for pin assignment see power supply manual Connect the both lateral protru...

Страница 16: ...III Software Seite 16 Software ...

Страница 17: ...B Watchdog Stick The Watchdog Configuration Utility is included in the DELIB driver library Default installation directory 32 Bit C Program Files x86 DEDITEC DELIB programs watchdog configuration utility exe 64 Bit C Program Files DEDITEC DELIB64 programs Watchdog Configuration Utility_x64 exe You can also start the Watchdog Configuration Utility via the Windows start menu The path is All programs...

Страница 18: ...ch the USB Watchdog sticks expects a retrigger signal from you pc system If the stick receives no retrigger signal in the time period the stick will go into the Timeout state and switches his relays accordingly 3 In this table can you set the complete relay behaviour for all the different USB Watchdog states State Deactivated This state is the start state when the USB Watchdog Stick receives prowe...

Страница 19: ...r this state two relay settings can be configured The first setting will be used immediately after the timeout The second setting will be used after the configured timeperiod in milliseconds 4 With this buttons can you save the configuration to the stick or load them from the stick to your pc You can also create a default configuration Remeber to save the default configuration to the USB Watchdog ...

Страница 20: ...o the autorun directory of your pc This programm enables the watchdog stick and sends every 2 seconds a retrigger signal to the stick If the system becomes unstable and freezes this program will also freeze and the retrigger signal will stop Download http www deditec de zip devtools vc_watchdog_retrigger_software zip You can find this program also on our DELIB driver disc vc_watchdog_retrigger_sof...

Страница 21: ...ion of the DELIB integration in Visual C C The DELIB Installation defines environment variables to facilitate links to the DELIB include and DELIB lib directory DELIB_LIB C Programs DEDITEC DELIB lib DELIB_INCLUDE C Programs DEDITEC DELIB include Start Visual C C and open via menu Projekt Einstellungen ...

Страница 22: ...Software Seite 22 DELIB H entry in the Visual C C Project configurations Under the tab C C choose the Kategorie Präprozessor and enter on Zusätzliche Include Verzeichnisse DELIB_INCLUDE ...

Страница 23: ...Software Seite 23 DELIB LIB entry in the Visual C C Project configurations Under the tab Linker extend the existing line in Zusätzliche Include Verzeichnisse with the ending DELIB_LIB delib lib ...

Страница 24: ...l C You can find the needed files for Visual C in the directory C Programme DEDITEC DELIB Include delib cs Start Visual C and open via menu Projekt Vorhandes Element hinzufügen in the directory C Programme DEDITEC DELIB Include the file delib cs to import Add the following reference in your program using DeLib ...

Страница 25: ...C unter Windows 64bit Program sample for the DELIB driver library under Windows 64 Bit In the following sections there is a description how to compile the project as x86 Show all settings Open the options via menue Extras Optionen Check Alle Einstellungen anzeigen ...

Страница 26: ...Software Seite 26 Check under Projekte und Projektmappen Erweiterte Buildkonfigurationen anzeigen ...

Страница 27: ...e Seite 27 The Configuration Manager Open the configuration manager via Any CPU Konfigurations Manager In the configuration manager select under der column Plattform Any CPU Neu Under Neue Plattform select x86 ...

Страница 28: ...Software Seite 28 Start debugging You can start the debugging as normal via the Start Button Note that the toolbar combobox for Platform Configuration now lists both x86 and AnyCPU and has x86 selected ...

Страница 29: ... in Delphi Description of the delib pas integration in Delphi You can find the needed files for Delphi in the directory C Programme DEDITEC DELIB include delib pas Start Delphi and open via menu Projekt dem Projekt hinzufügen the file delib pas to import ...

Страница 30: ...isual Basic Description of the delib bas integration in Visual Basic You can find the needed files for VB in the directory C Programme DEDITEC DELIB include delib bas Start Visual Basic and open via menu Projekt Datei hinzufügen the file delibi bas to import ...

Страница 31: ...the DELIB integration in VB NET You can find the needed files for VB NET in the directory C Programme DEDITEC DELIB Include delib vb Start VB NET and open via menu Projekt Vorhandes Element hinzufügen in the directory C Programme DEDITEC DELIB Include the file delib vb to import ...

Страница 32: ...S Office VBA Description of the delib bas integration in Visual Basic for Applications You can find the needed files for VBA in the directory C Programme DEDITEC DELIB include delib bas Start Microsoft Excel and open via menu Extras Makro Visual Basic Editor ...

Страница 33: ...erForm Create a new UserForm via menu Einfügen UserForm In the top left hand corner of the project manager right click on UserForm Datei importieren Open in the directory C Programme DEDITEC DELIB include the file delib bas to import ...

Страница 34: ...dul_Control vi is not a EXE File and you need to execute this file the LabVIEW development environment Description of the delib dll integration in LabVIEW Version 11 You can find the needed files for LabVIEW in the directorys C Windows System32 delib dll and C Programme DEDITEC DELIB include delib h Start LabVIEW and open the menu Tools Import DLL ...

Страница 35: ...Software Seite 35 Choose the option create VIs for DLL and press continue ...

Страница 36: ...Software Seite 36 In the next window choose the path to the delib h and delib dll and press continue ...

Страница 37: ...Software Seite 37 Press continue again The Header File will now be analized Afterwards press continue ...

Страница 38: ...Software Seite 38 Follow the instructions and configurate the name and the saving location for the VIs ...

Страница 39: ...Software Seite 39 In the new window choose Easy error correction in the drop down menu and press continue ...

Страница 40: ...th 64 bit values must be edited The display must be changed from unsigned long to unsigned quad The following VIs must be edited DapiCNT48CounterGet48 function return DapiDIGet64 function return DapiDOSet64 data DapiDOReadBack64 function return ...

Страница 41: ...oftware Seite 41 In addition for some VIs you need to change the elementype to numeric The following VIs must be edited DapiWriteLongLong value DapiReadLongLong function return Afterwards press continue ...

Страница 42: ...Software Seite 42 You recive a summary of the executed steps Press continue The VIs will now be created and are ready to use ...

Страница 43: ...oid DapiADSetMode ULONG handle ULONG ch ULONG mode The voltage ranges for this function are already defined in the DELIB library Example code in C C DapiADSetMode handle 0 ADDA_MODE_UNIPOL_5V This code can also be written like this DapiADSetMode handle 0 1 In the delib h file can you read the hexadecimal values to determine the modes The hex values must be convertet to decimal After the installati...

Страница 44: ...Software Seite 44 The function could look like this in LabVIEW The channel and mode are passed as unsigned long ...

Страница 45: ...Software Seite 45 ...

Страница 46: ...IV DELIB API reference Seite 46 DELIB API reference ...

Страница 47: ...pened see delib h nr Indicates No of module which is to be opened nr 0 1 module nr 1 2 module Return value handle handle to the corresponding module handle 0 Module was not found Remarks The handle returned by this function is needed to identify the module for all other functions Example program USB Modul öffnen handle DapiOpenModule RO_USB1 0 printf handle x n handle if handle 0 USB Modul wurde n...

Страница 48: ...piCloseModule Description This command closes an opened module Definition ULONG DapiCloseModule ULONG handle Parameters handle This is the handle of an opened module Return value none Example program Close the module DapiCloseModule handle ...

Страница 49: ...n ULONG DapiGetDELIBVersion ULONG mode ULONG par Parameters mode Mode with which the version is readout must be 0 par This parameter is not defined must be 0 Return value version Version number of the installed DELIB version hex Example program version DapiGetDELIBVersion 0 0 Bei installierter Version 1 32 ist version 132 hex ...

Страница 50: ...of an open module Get number of digital input channels par DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI Get number of digital output channels par DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DO Get number of digital in output channels par DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DX Get number of analog input channels par DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_AD Get number of analog output channels par DAPI_SPECIAL_GET_MODU...

Страница 51: ...Anzahl der digitalen Eingangskanäle zurück ret DapiSpecialCommand handle DAPI_SPECIAL_CMD_GET_MODULE_CONFIG DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DO 0 0 Gibt die Anzahl der digitalen Ausgangskanäle zurück ret DapiSpecialCommand handle DAPI_SPECIAL_CMD_GET_MODULE_CONFIG DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DX 0 0 Gibt die Anzahl der digitalen Ein Ausgangskanäle zurück ret DapiSpecialCommand handle DAPI_...

Страница 52: ...module which is to be opened nr 0 1 module nr 1 2 module exbuffer buffer for IP adresse and port Return value handle handle to the corresponding module handle 0 Module was not found Remarks The handle returned by this function is needed to identify the module for all other functions Currently this command is only supported by our RO ETH Series Example program Open ETH Module with parameter DAPI_OP...

Страница 53: ...LastError Description This function returns the last registered error Definition ULONG DapiGetLastError Parameters None Return value Error code 0 no error see delib h Example program ULONG error error DapiGetLastError if error 0 return FALSE printf ERROR d error ...

Страница 54: ...tern ULONG __stdcall DapiGetLastErrorText unsigned char msg unsigned long msg_length Parameters msg text buffer msg_length length of the buffer Example program BOOL IsError if DapiGetLastError DAPI_ERR_NONE unsigned char msg 500 DapiGetLastErrorText unsigned char msg sizeof msg printf Error Code x Message s n 0 msg return TRUE return FALSE ...

Страница 55: ... 1 DapiWatchdogEnable Description This function enables the watchdog Definition void DapiWatchdogEnable ULONG handle Parameters handle This is the handle of an opened module Return value None Example program DapiWatchdogEnable handle Aktiviert den Watchdog ...

Страница 56: ...gDisable Description This function disables the watchdog Definition void DapiWatchdogDisable ULONG handle Parameters handle This is the handle of an opened module Return value None Example program DapiWatchdogDisable handle Deaktiviert den Watchdog ...

Страница 57: ... Description This function retriggers the watchdog timer Definition void DapiWatchdogRetrigger ULONG handle Parameters handle This is the handle of an opened module Return value None Example program DapiWatchdogRetrigger handle Retriggert den Watchdog Timer ...

Страница 58: ...instellungen Linker Objekt Bibliothek Module letzter Eintrag konfigurieren include windows h include stdio h include conio h include delib h void main void unsigned long handle unsigned long data unsigned long anz unsigned long i unsigned long chan USB Modul öffnen handle DapiOpenModule USB_Interface8 0 printf USB_Interface8 handle x n handle if handle 0 USB Modul wurde nicht gefunden printf Modul...

Страница 59: ...iWriteByte handle 1 data printf Schreibe auf Adresse 0 daten 0x x n data Einen Wert auf die Ausgänge schreiben data 255 DapiWriteByte handle 2 data printf Schreibe auf Adresse 2 daten 0x x n data Einen Wert von den Eingängen lesen data unsigned long DapiReadByte handle 0 printf Gelesene Daten 0x x n data Einen A D Wert lesen chan 11 read chan 11 data DapiReadWord handle 0xff010000 chan 2 printf Ad...

Страница 60: ...V Appendix Seite 60 Appendix ...

Страница 61: ...DapiGetDELIBVersion new Watchdog Special functions DapiSpecialWatchdogGetStatus DapiSpecialWatchdogGetTimeoutMsec DapiSpecialWatchdogGetWDCounterMsec DapiSpecialWatchdogGetTimeoutRelaisCounterMsec DapiSpecialWatchdogSetTimeoutRel1CounterMsec and DapiSpecialWatchdogSetTimeoutRel2CounterMsec Rev 2 00 Added chapters Firmware update and Integration of the DELIB Rev 2 01 Added Index ...

Страница 62: ...gistered trade mark of Microsoft Corporation USB is registered trade mark of USB Implementers Forum Inc LabVIEW is registered trade mark of National Instruments Intel is registered trade mark of Intel Corporation AMD is registered trade mark of Advanced Micro Devices Inc Dell is a registered trade mark of Dell Inc ...

Отзывы: