Jump to content

bilancata

Members
  • Posts

    1
  • Joined

  • Last visited

    Never

bilancata's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi guys, I need to know if is possible, how to obtain a the handler of a callback function written in a C source file which further to be passed as an input parameter to a VI. This VI registers the handler for a function that will call the callabck function when a message is received on the serial channel. Please find below a small example of how these functions are used in C based applicaitons: void CallbackFunction(WORD variable1, WORD variable2, long value) { if(variable1 == EXAMPLE_AXIS_ID_001 && variable2 == SRL_ADDRESS) { printf("The value is: %ld [long]\n", value); } } void main() { RegisterHandler( &CallbackFunction ); // function from DLL file made by me while(1) { CheckForMessages(); // function from DLL made by me } return 0; } /*-------- the end of example---------*/ the function prototype is the following: #ifdef WIN32 typedef void (__stdcall *pfnCallbackRecvDriveMsg)(WORD wAxisID, WORD wAddress, long Value); #else typedef void (*pfnCallbackRecvDriveMsg)(WORD wAxisID, WORD wAddress, long Value); #endif void TML_EXPORT RegisterHandler(pfnCallbackRecvDriveMsg handler); /******************************************************************************************* Function: Register application's handler. Input arguments: pfnCallbackRecvDriveMsg: pointer to handler Output arguments: *******************************************************************************************/ BOOL TML_EXPORT CheckForUnrequestedDriveMessages(); /******************************************************************************************* Function: Check if there are new messages and call handler for every message received. Input arguments: Output arguments: return: TRUE if no error; FALSE if error *******************************************************************************************/ Is possibel to use the CIN option and how ? If you have further questions please don't hesitate to contact me....
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.