Deditec USB-WATCHDOG-STICK Hardware-Description

USB-WATCHDOG-STICK
Hardware-Description
2011
Februar
INDEX
1. Introduction 5
2. Hardware description 7
3. Software 12
3.1.1. Access via graphical applications
3.1.2. Access via the DELIB driver library
3.1.3. Access via protocol
3.1.4. Access via provided test programs
3.2.1. Overview
3.2.1.1. Program under diverse operating systems
3.2.1.2. Program with diverse programming languages
3.2.1.3. Program independent of the interface
3.2.1.4. SDK-Kit for Programmer
3.2.2. Supported operating systems
3.2.3. Supported programming languages
3.2.4. Installation DELIB driver library
3.2.5. DELIB Configuration Utility
12 12 12 13
14
14 15 15 15
16 16
17
19
3.3.1. Watchdog Demo
20
4. DELIB API reference 22
Index |
2Seite
INDEX
4.1.1. DapiOpenModule
4.1.2. DapiCloseModule
22 23
4.2.1. DapiGetLastError
4.2.2. DapiGetLastErrorText
24
25
4.3.1. DapiWatchdogEnable
4.3.2. DapiWatchdogDisable
4.3.3. DapiWatchdogRetrigger
26
27
28
5. Appendix 32
Index |
3Seite
Introduction
I
Introduction |
Seite 4
1. Introduction
1.1. General remarks
First of all, we would like to congratulate you to the purchase of a high quality DEDITEC product.
Our products are being developed by our engineers according to quality requirements of high standard. Already during design and development we take care that our products have -besides quality- a long availability and an optimal flexibility.
Modular design
The modular design of our products reduces the time and the cost of development. 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 chance, you are not content with the performance of our product, please contact us by phone or mail immediately.
We take care of the problem.
1.3. Customer response
Our best products are co-developments together with our customers. Therefor we are thankful for comments and suggestions.
Introduction |
Seite 5
Hardware description
II
Hardware description |
Seite 6
2. Hardware description
The electronic, which is taken in an USB stick case, cares for the monitoring with watchdog functions. The used micro controller is scanned in periodic 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.
Hardware description |
Seite 7
2.1. Overview screen
Hardware description |
Seite 8
2.2. Technical data
USB stick 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)
Hardware description |
Seite 9
2.3. Pin assignment DSUB-9 connector
Pin
Description
3 & 7
Relay 1
2 & 6
Relay 2
1, 4, 5, 8, 9
NC
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
2.4. Control LED
The LED on the watchdog stick displays following status:
Hardware description |
Seite 10
Software
III
Software |
Seite 11
3. Software
3.1. Using our products
3.1.1. Access via graphical applications
We provide driverinterfaces e.g. for LabVIEW and ProfiLab. The DELIB driver library is the basis, which can be directly activated by ProfiLAB.
For LabVIEW, we provide a simple driver connection with examples!
3.1.2. Access via the DELIB driver library
In the appendix, you can find the complete function reference for the integration of our API-functions in your software. In addition we provide examples for the following programming languages:
C C++ C# Delphi VisualBasic VB.NET MS-Office
3.1.3. Access via protocol
The protocol for the activation of our products is open source. So you are able to use our products on systems without Windows or Linux.
Software |
Seite 12
3.1.4. Access via provided test programs
We provide simple handling test programs for the most important functions of our products. These will be installed automatically by the installation of the DELIB driver library.
So you can test directly e.g. relays or you can check the voltage of an A/D converter.
Software |
Seite 13
3.2. DELIB driver library
3.2.1. Overview
The following figure explains the structure of the DELIB driver library
The DELIB driver library allows an uniform response of DEDITEC hardware with particular consideration of the following viewpoints:
Independent of operating system Independent of programming language Independent of the product
3.2.1.1. Program under diverse operating systems
The DELIB driver library allows an uniform response of our products on diverse operating systems.
We has made sure, that all of our products can be responded by a few commands. Whatever which operating system you use. - Therefore the DELIB cares!
Software |
Seite 14
3.2.1.2. Program with diverse programming languages
We provide uniform commands to create own applications. This will be solved by the DELIB driver library.
You choose the programming language!
It can be simply developed applications under C++, C, Visual Basic, Delphi or LabVIEW®.
3.2.1.3. Program independent of the interface
Write your application independent of the interface ! Program an application for an USB product of us. - Also, it will work with an
ethernet or RS-232 product of us !
3.2.1.4. SDK-Kit for Programmer
Integrate the DELIB in your application. On demand you receive an installation script for free, which allows you, to integrate the DELIB installation in your application.
Software |
Seite 15
3.2.2. Supported operating systems
Our products support the following operating systems:
Windows 7 Windows Vista Windows XP Windows 2000 Linux
3.2.3. Supported programming languages
Our products are responsive via the following programming languages:
C C++ C# Delphi VisualBasic VB.NET MS-Office
Software |
Seite 16
3.2.4. Installation DELIB driver library
DELIB stands for DEDITEC Library and contains the necessary libraries for the modules in the programming languages C, Delphi and Visual Basic.
Insert the DEDITEC driver CD into the drive and start „delib_install.exe“. The DELIB driver library is also available on http://www.deditec.en/delib
Click on „Install“.
Software |
Seite 17
The drivers will be installed.
The DELIB driver library is now installed. Press „Close“ to finish the installation.
You can configure your module with the „DELIB Configuration Utility“ (see next chapter). This is only necessary, if more than one module is present.
Software |
Seite 18
3.2.5. DELIB Configuration Utility
Start the “DELIB Configuration Utility” as follows: Start Programs DEDITEC DELIB DELIB Configuration Utility.
The „DELIB Configuration Utility“ is a program to configure and subdivide identical USB-modules in the system. This is only necessary if more than one module is present.
Software |
Seite 19
3.3. Test programs
3.3.1. Watchdog Demo
Start "Watchdog Demo" as follows: Programme -> DEDITEC -> DELIB -> Watchdog Demo
This screenshot shows a test of the watchdog stick. The configuration of the module is shown on the upper left side.
Software |
Seite 20
DELIB API reference
IV
DELIB API reference |
Seite 21
4. DELIB API reference
// USB-Modul öffnen handle = DapiOpenModule(RO_USB1, 0); printf("handle = %x\n", handle); if (handle==0) { // USB Modul wurde nicht gefunden printf("Modul konnte nicht geöffnet werden\n"); return; }
4.1. Management functions
4.1.1. DapiOpenModule
Description
This function opens a particular module.
Definition
ULONG DapiOpenModule(ULONG moduleID, ULONG nr);
Parameters
moduleID=Specifies the module, which is to be opened (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
DELIB API reference |
Seite 22
4.1.2. DapiCloseModule
// Close the module DapiCloseModule(handle);
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
DELIB API reference |
Seite 23
4.2. Error handling
ULONG error; error=DapiGetLastError(); if(error==0) return FALSE; printf("ERROR = %d", error);
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
DELIB API reference |
Seite 24
4.2.2. DapiGetLastErrorText
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; }
Description
This function reads the text of the last registered error.
Definition
extern ULONG __stdcall DapiGetLastErrorText(unsigned char * msg, unsigned long msg_length);
Parameters
msg = text buffer msg_length = length of the buffer
Example program
DELIB API reference |
Seite 25
4.3. Watchdog functions
DapiWatchdogEnable(handle); //Watchdog enabled
4.3.1. DapiWatchdogEnable
Description
This function enables the watchdog.
Definition
void DapiWatchdogEnable(ULONG handle);
Parameters
handle=This is the handle of an opened module.
Return values
None
Example program
DELIB API reference |
Seite 26
4.3.2. DapiWatchdogDisable
DapiWatchdogDisable(handle); //Watchdog disabled
Description
This function disables the watchdog.
Definition
void DapiWatchdogDisable(ULONG handle);
Parameters
handle=This is the handle of an opened module.
Return values
None
Example program
DELIB API reference |
Seite 27
4.3.3. DapiWatchdogRetrigger
DapiWatchdogDisable(handle); //Watchdog timer retriggered
Description
This function retriggers the watchdog timer.
Definition
void DapiWatchdogRetrigger(ULONG handle);
Parameters
handle=This is the handle of an opened module.
Return values
None
Example program
DELIB API reference |
Seite 28
4.4. Example program
// **************************************************************************** // **************************************************************************** // **************************************************************************** // **************************************************************************** // **************************************************************************** // // (c) DEDITEC GmbH, 2011 // // Samples for USB-WATCHDOG // // vc-usb-watchdog-sample.cpp // // // **************************************************************************** // **************************************************************************** // **************************************************************************** // **************************************************************************** // **************************************************************************** // // // Folgende Bibliotheken beim Linken mit einbinden: delib.lib // Dies bitte in den Projekteinstellungen (Projekt/Einstellungen/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 wd_status, wd_timeout, wd_counter;
// ----------------------------------------------------
// USB-Modul öffnen
handle = DapiOpenModule(USB_WATCHDOG,0);
printf("handle = %x\n", handle);
if (handle==0)
{
// USB Modul wurde nicht gefunden printf("Modul konnte nicht geöffnet werden\n"); printf("TASTE für weiter\n"); getch(); return;
DELIB API reference |
Seite 29
}
// ----------------------------------------------------
// activate watchdog
DapiWatchdogEnable(handle);
printf("watchdog is activated\n");
printf("Taste für weiter\n");
getch();
// ----------------------------------------------------
// activate watchdog
DapiWatchdogDisable(handle);
printf("watchdog is deactivated\n");
printf("Taste für weiter\n");
getch();
// ----------------------------------------------------
// activate watchdog + retrigger
DapiWatchdogEnable(handle);
DapiWatchdogRetrigger(handle);
printf("watchdog is enabled+retriggered\n");
wd_status=0;
while(!kbhit() && wd_status!=2)
{
wd_status = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG,
DAPI_SPECIAL_WATCHDOG_GET_STATUS, 0, 0);
wd_counter = DapiSpecialCommand(handle,
DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_GET_WD_COUNTER_MSEC, 0, 0);
wd_timeout = DapiSpecialCommand(handle,
DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_GET_TIMEOUT_MSEC, 0, 0);
printf("WD-Status=%d * WD-Timeout=%dms * WD-Counter = %dms\n",
wd_status, wd_timeout, wd_counter);
}
if(wd_status==2)
{
printf("status=2 -> Watchdog TIMEOUT !!!!\n"); } printf("Taste für weiter\n"); getch();
// ---------------------------------------------------­// Modul wieder schliessen DapiCloseModule(handle);
printf("TASTE für weiter\n"); getch();
return ;
}
DELIB API reference |
Seite 30
Appendix
V
Appendix |
Seite 31
5. Appendix
5.1. Revisions
Rev 2.00 First issue
Appendix |
Seite 32
5.2. Copyrights and trademarks
Linux is registered trade-mark of Linus Torvalds.
Windows CE is registered 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.
Appendix |
Seite 33
Loading...