[C] GSV-2AS VC++ issue

Software zur Datenerfassung: GSVcontrol, GSVmulti, GSVterm, ...;
Treiber: Labview, Windows-DLL, ...
Programmierung: Code-Snippets, ..
Aclabo
Beiträge: 2
Registriert: Mi 25. Apr 2018, 16:05

[C] GSV-2AS VC++ issue

Beitragvon Aclabo » Mi 25. Apr 2018, 16:25

Hello,

i'm developping a system with straingauss and i'm currently having some issues with the software part.

I try to read the value from a GSV-2AS with Microsoft VisualStudio IDE.

GSVactivate works fine by after the GSVread() fonction is not working for me and return 0.

I'm using the snippets bellow:

#include <windows.h>
#include<stdio.h>
#include <stdlib.h>


#include "Megsv.h" // MeGSV header
#pragma comment (lib, "MEGSV.lib") // MeGSV libraries


#define ComNr 5
#define BuffSize 1000

double read(void)
{

 double ad = 0;

 if (GSVactivate(ComNr, BuffSize) != GSV_OK) // Works fine
 {
  printf("\n[!] initialisation failed.\n");
  return 0;
 }

 if (GSVread(ComNr, &ad) == GSV_TRUE) // GSVread() return 0 and ad is not updated
 {
  //printf(" %1.3f\n", ad);
  printf("%lf\n", ad);
 }

 GSVrelease(ComNr);
 return ad;
}

int main(void)
{
 double val = 0;
 val = read();
 return 0;
}


I've no linking or dependancies issues.
Am i missing something ?

Thank you very much for your help by advance !!!

Kabelitz
Beiträge: 430
Registriert: Fr 5. Aug 2011, 12:09

Re: [C] GSV-2AS VC++ issue

Beitragvon Kabelitz » Sa 28. Apr 2018, 08:08

Hello Aclabo,
my first idea is, that there is no value ready to read, because GSV-2 device is configured in "logger" mode.
In this case you must use GSVgetvalue first, to create one value.

You can check, wheather GSV-2 is in logger mode with GSVmulti or GSVcontrol.

Or you load default settings. After that GSV-2 is sending pemanently values with 10 Samples per second.
But you should read them fast enough, e.g. with GSVreadmultiple. If not, you wil get values from the past (which are first in the output buffer)

Best regards
Holger

Aclabo
Beiträge: 2
Registriert: Mi 25. Apr 2018, 16:05

Re: [C] GSV-2AS VC++ issue

Beitragvon Aclabo » Fr 4. Mai 2018, 09:24

Hello Kabelitz,

Thank you for your support !

So i tried differents things with your remarks.

I add the GSVgetvalue() before calling GSVread() but i had no more results.

So i put the GSVread() in a while loop, here, i have the first value == 0 and after that i get a value != 0 on the second call and more (an other strange thing is that the value (-0.000xx)is not in accordance with the value from the GSV control software(-0.xxx)).

Is it possible to get just one value? I just want to push with a jack and take the value just one time for verify it is arround 50N, so this is very simple and i don't need the permanently acquisition.

Many thx for your help!

Kabelitz
Beiträge: 430
Registriert: Fr 5. Aug 2011, 12:09

Re: [C] GSV-2AS VC++ issue

Beitragvon Kabelitz » Do 10. Mai 2018, 06:30

Hello Aclabo
to get only one value on demand, you must configure the device into "logger -Mode". Then you can produce one value with getvalue and read this value with getvalue
Best regards
Holger


Zurück zu „Software“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste