626

From Sensoray Technical Wiki
Jump to: navigation, search


Contents

C/C++ apps must call S626_DLLOpen

Why do I get null pointer exceptions when I call API functions?

Windows application programs written in C/C++ must call S626_DLLOpen before calling any other API functions; failure to do this will cause null pointer de-referencing when you try to call other API functions. The following example shows how to do this:

#include <windows.h>
#include "win626.h"

int main(int argc, char* argv[])
{
  switch (S626_DLLOpen()) {   // Open the API. MUST CALL THIS FIRST!
  case ERR_LOAD_DLL:
    printf("can't open s626.dll\n");  // check dll path
    return -1;
  case ERR_FUNCADDR:
    printf("dll function(s) not found\n");  // check dll version
    S626_DLLClose();    // Close the API.
    return -1;
  default:  // if dll was successfully opened ...
    S626_OpenBoard(0, 0, NULL, THREAD_PRIORITY_NORMAL);
    if (S626_GetErrors(0))
      printf("errors opening board\n");
    else {              // Board was successfully opened, so ...
      RunApplication();    // App can now call other API functions.
      S626_CloseBoard(0);  // Close board before app terminates.
    }
    S626_DLLClose();    // Close the API.
    return 0;
  }
}

64-bit Windows

I successfully built a 626 program for my 64-bit Windows 7 system but it crashes when it executes. What could be the problem?

The 626 works with 64-bit Windows, but only with 32-bit applications. When building your application, make sure the CPU target is selected as 32-bit or Win32. This is done in various ways, depending on the build tools you are using. For example, VisualStudio provides a Configuration Manager for this purpose.

Encoder errors

The encoder interface misses some encoder clocks, especially at higher rotation speeds.

This can be caused by slow slew rates on the encoder signals. Examine the encoder clock signals with an oscilloscope. If you don't see sharp, fast rise and fall times, you may need to add external termination or pull-up resistance to the clock lines to speed up the edges.

Migrating to PCI Express

When upgrading your system to PCIe, we recommend Model 826 as a replacement for model 626. Please note that models 626 and 826 are not software compatible; due to its higher performance and expanded functionality, model 826 employs a different API and device driver. The following table compares the two boards:

Interface 626 826
System bus PCI PCI Express
Counters 6 channels
24-bit resolution
24-bit sample latch
6 channels
32-bit resolution
sample FIFO (16-deep) with timestamps and trigger info
GPIOs 48 channels
40 w/edge detection (1 Msps)
no debounce
not fail-safe
48 channels
48 w/edge detection (50 Msps)
debounce filter
fail-safe outputs
Analog out 4 channels
14-bit resolution
20 Ksps
not fail-safe
8 channels
16-bit resolution
900 Ksps
fail-safe outputs
Analog in 16 channels
16-bit resolution
15 Ksps
16 channels
16-bit resolution
300 Ksps
Watchdog timer Single stage
4 shunt-selectable intervals
3 timer stages
software programmable intervals
Fail-safe controller None Integrated
API interrupts Central callback Blocking function per interface

Windows installation debug

You must install both the board and the device driver before the 626 can be accessed by application software. If you've done this and still cannot communicate with the board:

  1. Open the device manager and see if the board appears there (it will be classified as a "multimedia controller"). If you don't see the board there ...
  2. Run msinfo32.exe and see if the board appears there. It will be listed as a "multimedia controller" and should appear in that section or, if the driver isn't installed, it should appear in the "problem devices" section. The board info will look like this:
Multimedia Controller    PCI\VEN_1131&DEV_7146&SUBSYS_02726000&REV_01\4&12432EBB&0&10F0

Troubleshooting

If you suspect a 626 board is malfunctioning:

  • You can test the board yourself if your have the necessary technical expertise and a desktop computer with PCI slots and Windows. First, download and install the Windows SDK for Model 626. Install your 626 board in the computer and run the demo program included in the SDK; this will allow you to manually exercise all of the interfaces on the 626 board. You can then loopback or connect any suspect interface to external devices (e.g., incremental encoders; loopback analog outputs to analog inputs, loopback digital I/Os) and manually test them.
  • When testing outputs (e.g., DAC, GPIO), start with all outputs disconnected. This will prevent possibly-bad output loads from affecting your test results.
  • If you are unable to test the board yourself, you can contact Sensoray Sales to arrange to have the board tested and, if necessary, repaired. Please note that there is a fee for this service.
  • If you're in a hurry and are certain that the 626 board is malfunctioning, you can purchase a new 626 board via Sensoray's online ordering system or by calling Sensoray Sales.

OpenCNC

Model 626 is widely used in CNC machines that run OpenCNC software. If you have such a machine and it is not operating normally, you may be able to obtain support from the machine manufacturer or from MDSI (Manufacturing Data Systems, Inc.), the developer of OpenCNC. Unfortunately Sensoray can't help you troubleshoot your CNC system but, if you suspect a malfunctioning 626 board, please refer to the troubleshooting options listed above.

Device driver

OpenCNC uses a proprietary device driver for model 626 which was developed by MDSI. This device driver is not compatible with the standard 626 device driver (included in Sensoray's 626 SDK) and is not available from Sensoray.

Ubuntu 16.04

To compile under Ubuntu version 16.04, locate this line in s626drv.c:

#include <linux/version.h>

and replace it with this:

#include <linux/version.h>
#include <linux/uaccess.h>

Simulink

A Simulink driver is available for model 626. Please note that Sensoray does not provide support for this driver as it was created by an unaffiliated third party developer. If you are encountering problems with the Simulink driver or have questions about it, we recommend that you consult the driver developer or Matlab to obtain help and further information.

Labview

Model 626 does not have pre-built VIs, but you can easily create your own as explained here.

Matlab

Sensoray does not provide Matlab wrappers for model 626 but you can create your own as explained here.

Running on virtual machines

The 626 functions normally on my machine, but I can't it to work in a virtual machine. What should I do?

It's possible that you might need a special BIOS setting for PCI pass-through. If that's the case then you may be able to get relevant information from your system manufacturer. If that doesn't pan out then it may be necessary to contact support for your VM software (e.g., VMWare or Oracle) for advice.

Personal tools
Namespaces

Variants
Actions
Toolbox