From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-10-2015 03:26 AM
hi here shambhu ,please any body help to write " C wrapper" for below callback function. Below call can be containing some C functions , please any one to write "C Wrapper" those dll can be labVIEW.Its for my final year B.E project needed these calls.
int CVICALLBACK RegisterStation (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
{
int i;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel, control, &i);
if(i > 0)
{
CCS = &CCS1[0];
GetCtrlVal (panel, PN_MAIN_TXB_SITE_ID, sPortID);
GetCtrlVal (panel, PN_MAIN_NUM_STN_IND, &uStationIndex);
i = GDSRegisterStation(sPortID, "Template", uStationIndex, (GDSCallback) GDSStatusCallback); //how to write GDS callback function in "C Wrapper" for passing - into labVIEW
if(i > -1)
bOnline = TRUE;
}
else
{
if(bOnline)
{
GDSUnregisterStation();
bOnline = FALSE;
}
}
break;
}
return 0;
}
//GDS Install Callbacks
GDSCallback GDSStatusCallback(CTRL_CHANNEL_STATUS *CCS2)//GDS Callback pointing here
{
int i, iError;
//Read Station Status here
if(bFirstGDSStatus)
{
if(GDSFetchNoOfActuators() != 1)
{
if(bOnline)
{
GDSUnregisterStation();
bOnline = FALSE;
}
return 0;
}
CCS = CCS2;
if(CCS->uLogChannels < 6)
{
if(bOnline)
{
GDSUnregisterStation();
bOnline = FALSE;
}
return 0;
}
//Function for these calls
_export int GDSRegisterStation(char *sPort, char* sPanel, int iStation, GDSCallback lpGDSTaskCall// Create C Wrapper for this call
//Structure defintion
#ifdef __cplusplus
extern "C" {
#endif
#define LOG_STREAM_ALL 0x0001 // Continuous indefinite streaming
#define LOG_STREAM 0x0002 // Conditional streaming
#define LOG_PKV 0x0004 // Peak/valley
#define LOG_START_NOW 0x0010 // Start immediately
#define LOG_START_TIME 0x0020 // Start at specified calendar time
#define LOG_START_CYC 0x0040 // Start at specified cycle count
#define LOG_START_PULSE 0x0080 // Start on external pulse input
#define LOG_END_POINTS 0x0100 // End upon specified data points
#define LOG_END_MILSECS 0x0200 // End upon specified duration (ms)
#define LOG_END_CYC 0x0400 // End upon specified incremental cycle count
#define LOG_END_PULSE 0x0800 // End on external pulse input
#define LIN_MEASURED 0
#define LIN_REFERENCE 1
typedef struct
{
unsigned
uDSPIO,
// uDAQMode,
// bControllerActive,
bShutDown,
bPowerOn,
bPowerHi,
bPowerFault,
bSGIdle,
bSGHold,
uBitsIn,
uBitsOut,
uCycleCount,
uCycResidue,
uBlockCount,
uLogChannels,
uCurrentMode,
uAsigndPhysCh[LOG_CHANNELS];
float
fSetPoint,
fDAQRate,
fRange[LOG_CHANNELS],
fReadout[LOG_CHANNELS],
fMax[LOG_CHANNELS],
fMin[LOG_CHANNELS];
char
sChID[LOG_CHANNELS][32],
sChUnits[LOG_CHANNELS][16];
}
CTRL_CHANNEL_STATUS;
03-10-2015 12:53 PM
Sorry, but it's unlikely anyone will be able to help you here without a lot more information (and even then, it's probably more work than anyone would be willing to do as free advice). You've provided some random C code, with no explanation of what it does, and asked for a "C wrapper" - do you actually know what you want, or are you just quoting someone else who said you need a wrapper in C? What does this have to do with LabVIEW?
03-10-2015 01:55 PM - edited 03-10-2015 01:56 PM
It is basically a duplicate post of his post from last week http://forums.ni.com/t5/LabVIEW/how-to-write-c-wrapper-it-containing-callback-functions/m-p/3098300
He apparently needs to convert a C program into LabVIEW.
At this point, he needs to tell his boss that they need to HIRE someone to do this project.
His other duplicate posts: