01-07-2011 06:45 PM
Having trouble with this line "void (*m_callback)(_t_pciCommand *cmd);" in PciApi.h file. I have replaced it with NULL and was able to import 2 functions, PciAllocCommand and PciSendCommand. I was then able to get valid information using GetValueByPointer.VI, but crash most of the time.
typedef struct _t_pciCommand
{
t_pciCommandType m_command;
t_commandError m_error;
long m_gpVal;
void (*m_callback)(_t_pciCommand *cmd);
long m_param[MAX_PCI_PARAMS];
int m_state;
int m_retries;
int m_expected;
long m_origParam[MAX_PCI_PARAMS];
} t_pciCommand;
All files attached. Based on this callback funtion, I can't seem to resolve 2 functions, called PciAllocCommand and PciSendCommand.
Thanks,
John
Solved! Go to Solution.
01-10-2011 02:40 AM - edited 01-10-2011 02:41 AM
LabVIEW can't support callbacks through Call Library Nodes. You will need to write a wrapper DLL in C/C++ that translates the callback function into a LabVIEW user event. Search for PostLVUserEvent here and on LAVA to find discussions and examples about this.
Beware: some sound C programming knowledge will be definitely required to understand this stuff and adapt it to your use case.
01-10-2011 09:38 AM
Rolf, I kind of expected this answer after going through this forum. My C skills are not that strong but I can modify exsisting code. I would like to take a different approach by removing the callback from the exsisting code. The callback function isn't required so I replaced it with NULL in the DLL.
What I need help with is to properly configure the VI. Using the references you pointed out in other posts, I was able to modify what Labview generated, but would like some verification that it is done properly.
01-10-2011 11:26 AM
Feel free to upload a VI and the description and C prototype of the function and its datatypes. I'll have a look at them then.
01-10-2011 01:29 PM
The manual is "pci_api_manual_jb.doc", The funtion I care most about is PciAllocCommand and the #1 issue I have is how to pass "m_param[0]" , "m_param[1]" and "m_param[2]" to the dll. The original h file is "PciApp(original).h" . The second issue would be if removing the callback functionality I need a VI to poll the status of "t_PciCommand "Function without writing to it.
For example, PciAllocCommand(c_baudrate, NULL, 0). How do I set baud = m_param[0]?
Also I am adding a TestApp.exe example of what I want to do in Labview, focusing on the Param1 and Param2
01-11-2011 09:57 AM
Up to rev 9 with better results and no crashing. I believe the remaining issue is how to poll "t_pciCommand".