07-01-2013 08:50 PM
Hi
I try read an protocol from RS232, but appear an error when I use "scan from string"..
I have an PIC18F who put on serial port "fprintf(outport,"* 13:53:03 * N * 2323.453 * W * 3542.092 * 12 * 33 * 29 \n");"
on my VI I need separete all parameters.
someone can help me to see the problem?
best regards
07-01-2013 09:06 PM
I do not think your error is in Scan from String. When I put the string you posted in, it returns all the values and no error.
Most likely the problem is the use of Bytes at Port. Since the PIC is sending a termination character (\n), just set the byte count input to VISA Read to a value larger than the number of characters you expect and let the Read wait for the \n. Then you get a complete message (except possibly on the first iteration) and the decoding should work OK.
Lynn
07-01-2013 09:44 PM
Hi
thanks
what ou make for don't have errors?
if a make may constante "0", have problems, if I put "1" or "2", continue with problems...
the is the easy way to solve my problem? (put my protocol, in diferentes windows)
"scan Strins" is the only wait who I now to make this...
somone can help mt?
best regards
07-01-2013 09:55 PM
It looks like you have 57 characters in the string you posted. Try setting byte count to 100 or 200.
Lynn
07-02-2013 01:25 AM
An array from spreadsheet string with '*' as separator should get you an array of the parameters (though the 1st one will be empty as you start off with a star)
/Y
07-02-2013 02:15 PM - edited 07-02-2013 02:17 PM
07-02-2013 02:24 PM
Lynn,
Take another look at that PIC output
the last two chars are "\n" thats NOT an ascii escaped newline
07-02-2013 02:35 PM
Hi
I program with CCS, and output printf is:
" fprintf(outport,"* %s * %s * %s * %s * %s * %s * %s * %lu\n",time, PNS, lat, PEW, longi, speed, alt, temperatura);"
I have "\n" on final...
07-02-2013 03:12 PM
Let's take this one step at a time. Does your PIC transmit a Line Feed character at the end of each transmission? Or is it literally sending a backslash character followed by a lower case n?
Lynn
07-02-2013 04:21 PM
Hi
I don't understand your questions johnsold...
my PIC put on serial port this string every 1second
sometimes it work... but after a few second program crash and when crash, on window "dados do circuito", don't start on 1º parameter...
if I only read string, when I receive an char like "#" ou an letter, I forced the program to read correct string, I think (with this I change my printf to have this 1º char before the "*")
best regards