LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using C structures in LabView

Hi,

I want to use this function into LabView:

struct my_output my_function (char * signal, unsigned size_signal)

the output of the function is a C structure:

struct my_output
{
double d_value;
unsigned u_value;
unsigned u_value2;
double d_value2;
.....
}my_output;

I would like to retrieve the C structure in a cluster in LabView.

Is it possible to convert from C structure type to cluster type in LabView?

Thanks in advance,

Miguel.
0 Kudos
Message 1 of 6
(1,659 Views)
First create CIN on your VI, then connect cluster to CIN's output.
Right click on CIN and choose to create .c file.
Output is belove.
More info on how to compile lsb file to be used by CIN is on NI website.
CIN=code interface node

/*
* CIN source file
*/

#include "extcode.h"

/*
* typedefs
*/

typedef struct {
float64 d_value;
float64 d_value2;
uInt32 u_value;
uInt32 u_value2;
} TD1;

CIN MgErr CINRun(TD1 *Cluster, float64 *input_d);

CIN MgErr CINRun(TD1 *Cluster, float64 *input_d) {

/* ENTER YOUR CODE HERE */

return noErr;
}

"Miguel" wrote in message
news:394a2bf3@newsgroups.ni.com...
> Hi,
>
> I want to use this function into LabView:
>
> struct my_output my_function (char * signal, unsigned size_signal)
>
> the output of th
e function is a C structure:
>
> struct my_output
> {
> double d_value;
> unsigned u_value;
> unsigned u_value2;
> double d_value2;
> .....
> }my_output;
>
> I would like to retrieve the C structure in a cluster in LabView.
>
> Is it possible to convert from C structure type to cluster type in
LabView?
>
> Thanks in advance,
>
> Miguel.
>
>
>




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
0 Kudos
Message 2 of 6
(1,659 Views)
Thanks for the information, but I have a dll function and I want to use
"call library function"
to access to the library.

Miguel.

Reinis Kanders escribió en el mensaje de noticias
394a352e$1_1@goliath.newsfeeds.com...
> First create CIN on your VI, then connect cluster to CIN's output.
> Right click on CIN and choose to create .c file.
> Output is belove.
> More info on how to compile lsb file to be used by CIN is on NI website.
> CIN=code interface node
>
> /*
> * CIN source file
> */
>
> #include "extcode.h"
>
> /*
> * typedefs
> */
>
> typedef struct {
> float64 d_value;
> float64 d_value2;
> uInt32 u_value;
> uInt32 u_value2;
> } TD1;
>
> CIN MgErr CINRun(TD1 *Cluster, float64 *input_d);
>
> CIN MgErr CINRun(TD1 *Cluster, float64 *in
put_d) {
>
> /* ENTER YOUR CODE HERE */
>
> return noErr;
> }
>
> "Miguel" wrote in message
> news:394a2bf3@newsgroups.ni.com...
> > Hi,
> >
> > I want to use this function into LabView:
> >
> > struct my_output my_function (char * signal, unsigned size_signal)
> >
> > the output of the function is a C structure:
> >
> > struct my_output
> > {
> > double d_value;
> > unsigned u_value;
> > unsigned u_value2;
> > double d_value2;
> > .....
> > }my_output;
> >
> > I would like to retrieve the C structure in a cluster in LabView.
> >
> > Is it possible to convert from C structure type to cluster type in
> LabView?
> >
> > Thanks in advance,
> >
> > Miguel.
> >
> >
> >
>
>
>
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
0 Kudos
Message 3 of 6
(1,659 Views)
http://digital.ni.com/explprog.nsf/75c7cd5de6d387788625663d00558a4c/3d9437c9
d630e5e48625683a000a8332?OpenDocument

Check this example, that should do it.

"Miguel" wrote in message
news:394a4056@newsgroups.ni.com...
> Thanks for the information, but I have a dll function and I want to use
> "call library function"
> to access to the library.
>
> Miguel.
>
> Reinis Kanders escribi� en el mensaje de noticias
> 394a352e$1_1@goliath.newsfeeds.com...
> > First create CIN on your VI, then connect cluster to CIN's output.
> > Right click on CIN and choose to create .c file.
> > Output is belove.
> > More info on how to compile lsb file to be used by CIN is on NI website.
> > CIN=code interface node
> >
> > /*
> > * CIN source file
> > */
> >
> > #include "extcode.h"
> >
> > /*
> > * typedefs
> > */
> >
> > typedef struct {
> > float64 d_value;
> > float64 d_value2;
> > uInt32 u_value;
> > uInt32 u_value2;
> > } TD1;
> >
> > CIN MgErr CINRun(TD1 *Cluster, float64 *input_d);
> >
> > CIN MgErr CINRun(TD1 *Cluster, float64 *input_d) {
> >
> > /* ENTER YOUR CODE HERE */
> >
> > return noErr;
> > }
> >
> > "Miguel" wrote in message
> > news:394a2bf3@newsgroups.ni.com...
> > > Hi,
> > >
> > > I want to use this function into LabView:
> > >
> > > struct my_output my_function (char * signal, unsigned size_signal)
> > >
> > > the output of the function is a C structure:
> > >
> > > struct my_output
> > > {
> > > double d_value;
> > > unsigned u_value;
> > > unsigned u_value2;
> > > double d_value2;
> > > .....
> > > }my_output;
> > >
> > > I would like to retrieve the C structure in a cluster in LabView.
> > >
> > > Is it possible to convert from C structure type to cluster type in
> > LabView?
> > >
> > > Thanks in advance,
> > >
> > > Miguel.
> > >
> > >
> > >
> >
> >
> >
> >
> > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> > -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
>
>




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
0 Kudos
Message 4 of 6
(1,659 Views)
Reinis,

Thank you for the program. This is just I need.
Miguel.



"Reinis Kanders" escribi� en el mensaje
news:394a5046_5@goliath.newsfeeds.com...
>
http://digital.ni.com/explprog.nsf/75c7cd5de6d387788625663d00558a4c/3d9437c9
> d630e5e48625683a000a8332?OpenDocument
>
> Check this example, that should do it.
>
> "Miguel" wrote in message
> news:394a4056@newsgroups.ni.com...
> > Thanks for the information, but I have a dll function and I want to use
> > "call library function"
> > to access to the library.
> >
> > Miguel.
> >
> > Reinis Kanders escribi� en el mensaje de noticias
> > 394a352e$1_1@goliath.newsfeeds.com...
> > > First create CIN on your VI, then connect cluster to CIN's output.
> > > Right click on CIN and choose to create .c file.
> > > Output is belove.
> > > More info on how to compile lsb file to be used by CIN is on NI
website.
> > > CIN=code interface node
> > >
> > > /*
> > > * CIN source file
> > > */
> > >
> > > #include "extcode.h"
> > >
> > > /*
> > > * typedefs
> > > */
> > >
> > > typedef struct {
> > > float64 d_value;
> > > float64 d_value2;
> > > uInt32 u_value;
> > > uInt32 u_value2;
> > > } TD1;
> > >
> > > CIN MgErr CINRun(TD1 *Cluster, float64 *input_d);
> > >
> > > CIN MgErr CINRun(TD1 *Cluster, float64 *input_d) {
> > >
> > > /* ENTER YOUR CODE HERE */
> > >
> > > return noErr;
> > > }
> > >
> > > "Miguel" wrote in message
> > > news:394a2bf3@newsgroups.ni.com...
> > > > Hi,
> > > >
> > > > I want to use this function into LabView:
> > > >
> > > > struct my_output my_function (char * signal, unsigned size_signal)
> > > >
> > > > the output of the function is a C structure:
> > > >
> > > > struct my_output
> > > > {
> > > > double d_value;
> > > > unsigned u_value;
> > > > unsigned u_value2;
> > > > double d_value2;
> > > > .....
> > > > }my_output;
> > > >
> > > > I would like to retrieve the C structure in a cluster in LabView.
> > > >
> > > > Is it possible to convert from C structure type to cluster type in
> > > LabView?
> > > >
> > > > Thanks in advance,
> > > >
> > > > Miguel.
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> > > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> > > -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
> >
> >
>
>
>
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
0 Kudos
Message 5 of 6
(1,659 Views)
Hi Miguel,
I have a problem which I think you might be able to help me with if you have time. I have a DLL function which requires a structure pointer (or a structure array) passed to it. Since I am using call library function I am trying to pass a cluster array to it, but it does not seem to be working. Can you help?
Regards,
Setu.
0 Kudos
Message 6 of 6
(1,659 Views)