LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert a char string into an array

This part is working fine now, Thanks for all your suggestions! They really helps and opens up my mind. How my program works(it is use to control a step motor) and the motor runs. The only problem now is that after the first iteration(I put everything in a while loop) labview crashes, everything just shuts. All labview windows are closed. Any guess what could have gone wrong?
Can a computer learn how to program?
0 Kudos
Message 11 of 21
(2,179 Views)
You will need to post your code so that we can look at it. One thing to look at is that all while loops should have some time delay to allow for CPU to handle other processes. Also, make sure you aren't opening files in a loop without closing them within the loop, or creating VISA sessions in the loop without closing them in the loop. Opening/Creating should be done before the loop, and closing should be done after the loop.
- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 21
(2,178 Views)
Thanks again, this is the vi.
Can a computer learn how to program?
0 Kudos
Message 13 of 21
(2,175 Views)
It looks like you are initializing a port in your first frame, then reading from the port and writing to the port in the next two frames. When the loop repeats, you are initializing an already initialized port again. This may be why it crashes. Try moving the first frame out of the loop and run it before the loop. Your loop should just read and write. After the loop, you should call a function to close the port.
- tbob

Inventor of the WORM Global
Message 14 of 21
(2,166 Views)

I'm trying call a dll with input type unsigned char, I have to convert integer array to unsignedchar..

 

Thanks in advance..

0 Kudos
Message 15 of 21
(1,922 Views)

in the function panel, go to numerical---->conversion---->byte array to string function may just do the job.

 

Kevin

Can a computer learn how to program?
Message 16 of 21
(1,901 Views)

thanks Kevin,

 But i made a mistake in posting i wanna pass pointer to char string..I found code creating a array pointer and reading array in LV. 

0 Kudos
Message 17 of 21
(1,896 Views)

Here is how I  understand your question: you have a dll function that needs to be fed a pointer of char.  Labview does not differentiate a pointer from an array.  so all you have to do is to feed your dll function with an array of the type char, you may want  to try to use created an array function to generate the required char array.  it can be found where you get your initialize array function.

 

kevin

Can a computer learn how to program?
0 Kudos
Message 18 of 21
(1,889 Views)

@kevin

U understood my problem correctly..Bu t i didn't understood "you may want  to try to use created an array function to generate the required char array.  it can be found where you get your initialize array function".

0 Kudos
Message 19 of 21
(1,874 Views)

I think all you need to do is to change the data type in your example to a U8 (i.e. char) instead of an I32.

 

Message Edited by paulmw on 09-29-2009 08:22 AM
0 Kudos
Message 20 of 21
(1,870 Views)