LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1097 error in Call Library Function Node

Hello,

 

I am very new to LabVIEW and programming alltogether. I am trying to control a deformable mirror with LabVIEW 2017 Robotics. I have the .dmc files and .dll provided by the company but i get a 1097 (hex 449) error when i try to call them with the call library function. The vi does not stop it just does not initialize the device.

 

I have already tried changing the calling convention but it does not solve the problem. I also tried setting error handling to maximum but no extra errors got reported.

 

I am not sure what is the next step to solve this. Here is a part of the VI (also provided by the company), i hope it helps.

 

thank you 🙂

 
 

Unbenannt.PNG

 

 

 

0 Kudos
Message 1 of 17
(697 Views)

Something is wrong.

 

Hard to say what exactly without the VI or the function protocols.

 

Without those we have no idea what you made, not what it should be.

 

Does the 1st function work? That should be the easier one of the two. Still lots of room for errors though.

0 Kudos
Message 2 of 17
(652 Views)

Hi

 

i have attached the function protocols. I am sorry i forgot them before.

first node calls the nChannelsDmc function. I have set paremeters :

  • ret as a signed 32-bit interger
  • filename as a C string pointer

second node calls the setVoltagesDmc function with parameters:

  • ret and filename as before
  • vlt as a 8-byte double array data pionter

both report the 1097 error, but the vi doesnot stop. they just always return 0.

 

another thing is that i have two types of dmc files :

when i use *usb.dmc i get no error but the functions still only return zero

when i use *eth.dmc i get the 1097 errors

 

 

thank you for taking the time to look into this  

0 Kudos
Message 3 of 17
(622 Views)

I'd start with dmcFree(). If that gives an error, something might be wrong with the dll, like a missing resource. Then again, dmcFree() might throw an exception because no resource was allocated. Who knows.

 

What might be wrong is the formatting of the path. A \ is used as an escape character in some C\C++ functions. The path has \'s. Perhaps replacing all \'s with \\'s will help. You can test this quickly with a string constant, and for a more definite solution use the Search and Replace String function. 

 

0 Kudos
Message 4 of 17
(615 Views)

i tried dmcFree and it seems to be working fine. At least it reports no errors.

 

I also tried the rest of the functions. Error 1097 appears when the filename parameter is required and only if i set the string parameter as a C String Pointer. If i use any othe string format there is no error. But then again even when i do not get Errors the return value is always Zero. 

0 Kudos
Message 5 of 17
(603 Views)

@Sid_Vicious wrote:

i tried dmcFree and it seems to be working fine. At least it reports no errors.

 

I also tried the rest of the functions. Error 1097 appears when the filename parameter is required and only if i set the string parameter as a C String Pointer. If i use any othe string format there is no error. But then again even when i do not get Errors the return value is always Zero. 


Have you tried the \ to \\ conversion?

0 Kudos
Message 6 of 17
(592 Views)

@Sid_Vicious wrote:

If i use any othe string format there is no error. But then again even when i do not get Errors the return value is always Zero. 


If you pass a Pascal string, the string gets proceeded with it's size. Probably a I16 or I32. That means a 0, as the string is < 256 bytes. C stops reading after the first 0. So it won't crash, but will never result in a correct string. 

0 Kudos
Message 7 of 17
(590 Views)

Hi again,

 

Yes i tried substituting the \'s with \\'s but it doesn't seem to make a difference. 

 

I am not sure i understand the last comment. Are you suggesting that i use a Pascal string or a c string pointer? both return 0 btw.

 

But even the nChannels function for example that does not require a .dmc (filename) still only returns zero. So i don't think the problem is there.

 

I am certain that the units are recognized by the pc because i can control them with other applications. It's only LabVIEW that doesn't work.

 

0 Kudos
Message 8 of 17
(541 Views)

@Sid_Vicious wrote:

I am not sure i understand the last comment. Are you suggesting that i use a Pascal string or a c string pointer? both return 0 btw.


No. Just that a pascal string might not crash, but that this doesn't mean it's an improvement.

 


@Sid_Vicious wrote:

But even the nChannels function for example that does not require a .dmc (filename) still only returns zero. So i don't think the problem is there.


I think nChannels does need a file, just not as an input. I think, but am not sure at all, you should use the file function to load a file into the dll, that is then used by the other functions.

 

The documentation is really primitive.

 

What you need is an example, preferably one that works. It doesn't really matter if it's written in C, VB or whatever. You need some comparison.

 


@Sid_Vicious wrote:

I am certain that the units are recognized by the pc because i can control them with other applications. It's only LabVIEW that doesn't work.


If one of those applications is small, we could have a look under the hood. If you have source code of any of them, even better.

0 Kudos
Message 9 of 17
(526 Views)

ok so there has been some progress.

There was  a mistake in my dmc file, i fixed it and now most of the functions work properly except the setvoltages and setvoltagesDmc that still return a 1097 error. I am fairly certain that both the calling convention and the datatypes are set  correctly. Also the library seems to be working fine since the rest of the functions work properly. I can't really think of anything else that might be causing the problem. I would appreciate any suggestions.

 

I think these are the only functions that actually communicate with the mirror. The rest work even when the device is not connected just by reading the dmc. Are there any extra steps, or drivers that need to be installed in order for labview to be able to communicate with the device?

 

 

0 Kudos
Message 10 of 17
(475 Views)