LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C code to LabVIEW specifics

What documentation do you have for the CFGSpaceWire_GetNumberLinks function?  Why are you passing a pointer to nDeviceNum as the dwNumLinks input?  Is the type of star_device_handle the same as HANDLE, or should you be calling some other function to convert from one to the other?  What specific error do you get?
0 Kudos
Message 11 of 15
(1,056 Views)

You cannot wire the nDeviceNum output of the first function to the *dwNumLinks input of the other function. You are basically telling the second function to go ahead and use the memory location allocated to hold the device number to store the number of links. This makes no sense. You need to connect a block diagram constant (its value is irrelevant, so leave it at zero) to the *dwNumLinks input.

 

Also, have you checked that the "star_device_handle" datatype is supposed to be the same as the datatype of "HANDLE"? As far as the actual value is concerned, have you checked the documentation for the DLLs that the value of phDevice is what you're supposed to pass to the second function?

Message Edited by smercurio_fc on 12-31-2009 09:44 AM
0 Kudos
Message 12 of 15
(1,051 Views)

Here are the explanation for the CFGSpaceWire_GetNumberLinks parameters:

 

hDevice: A handle to a SpaceWire USB device returned by a call to USBSpaceWire_Open().

dwNumLinks: A pointer to a variable which will be set to contain the number of links on the device.

 

The errors I am receiving are either:

 

CFG_TRANSMIT_PACKET_FAILURE: A write to the device failed.

CFG_REPLY_PACKET_FAILURE: A response from the device failed.

0 Kudos
Message 13 of 15
(1,046 Views)

Okay, thanks for the heads up on the *dwNumLinks. I changed the input to a constant but the problem is still there. 

 

Yes, the star_device_handle is the same datatype of HANDLE. The observed value appears to be some random value specific to the device. The documentation doesn't give this value, it appears to be random when I run the code. 

 

More concerning the hDevice parameter, if I'm passing a Pointer to Valule, the error is CFG_TRANSMIT_PACKET_FAILURE. If I'm passing a value, the error is CFG_REPLY_PACKET_FAILURE.

0 Kudos
Message 14 of 15
(1,025 Views)

Is star_device_handle the same as HANDLE, or as HANDLE *?  Based on the error messages and the function prototypes I'd say you want to pass hDevice by value; at least that way you're successfully transmitting and are getting the error on the receive.

 

If you pass dwNumLinks as a pointer, and the function fills in the value for you, then it doesn't matter whether you configure it to be a constant or get it from somewhere else, since LabVIEW will pass the address of that value and not the value itself.  Are you sure your device is responding properly?  Is it possible you do have it working, and the remote device isn't responding, causing the REPLY_PACKET_FAILURE?

0 Kudos
Message 15 of 15
(1,017 Views)