03-27-2012 08:58 AM
Hi,
I'm new to LabVIEW and I have now a problem looking for solution.
I have an interface in LabVIEW communicating with a microcontroller with VISA (through RS232). So I'm sending a string from the microcontroller and receiving it in LabVIEW. That's fine until now.
Now I have no analyze that string, the string is something like "!13R45.965V0.220$ 1" and I want to get those values in different indicators. I tried scan from string already and it doesn't work. The problem is relatively simple, LabVIEW doesn't see the entire string, it sees it char by char.
So what I want is a function that builds a string from those chars in the input.
03-27-2012 09:50 AM
LabVIEW's Scan From String sees whatever string you send to it. If you are sending it a single character, then that would be a fault of the way you've written your program. Simply saying it does not work does not really help explain your problem. How exactly do you want that string formatted?
03-27-2012 03:49 PM
Basically what I want is to concatenate incoming chars into a string. But the number of chars is variable.
03-27-2012 04:24 PM
03-27-2012 04:35 PM
yes, but I have only 1 input
03-27-2012 04:37 PM
@Baioneta wrote:
Basically what I want is to concatenate incoming chars into a string. But the number of chars is variable.
That's a basic operation with a loop and a shift register for the concantanate function. You should attach your code. With serial, it's easy to know how many characters to read or how to stop a loop with the read in it.
03-27-2012 04:49 PM
Here it is.
the code to print it through the port is
void transmite(char c)
{
while(!TRMT); //waits if the transmitter is busy
TXREG=c;} //sends char c
void imprim(char *texto){
index=0;
while(texto[index]!=0) transmite(texto[index++]);} //Sends the chars untill it finds a null char
03-27-2012 05:28 PM
Your wiring is sloppy and you should use a shift register instead of a local variable but you should be getting the complete string now.
03-27-2012 05:37 PM
I'm new to LabVIEW ![]()
I used the local variable because I want my output to show all the last data, to do it with the shift registers I'd have to add a lot of shift registers, right?
03-27-2012 06:13 PM
ok, I guess I figured out what I have to do. Now I have just one more problem. The "for" loop runs even if there's no new char.
I'm thinking about creating a delay to do some sort of synchronization.
The changes are in the new .vi