11-09-2011 09:01 AM
I'm writing a serial command to a microcontroller (DUT) and it takes 20 seconds (which are marked by 20 dots)
to respond back to the READ function buffer.
I have 5 conditional answers from which only 4 will be spitted out as follow:
a) . . . . . . . . . . . . . . . . . . . . (this is a time interval for the microprocessor do its job)
b) Cal Results, 00.0degC,0000.00,0000.00,0000.00,0000.00,0000.00,0000.00 (ucontroller will provide these numbers)
c) Calwarm pass gyro (ucontroller will provide this answer for a good DUT)
d) Calwarm pass accel (ucontroller will provide this answer for a good DUT)
or
a) . . . . . . . . . . . . . . . . . . . . (this is a time interval for the microprocessor do its job)
b) Cal Results, 00.0degC,0000.00,0000.00,0000.00,0000.00,0000.00,0000.00 (ucontroller will provide these numbers)
c) Calwarm fail gyro bias outside valid range (ucontroller will provide this answer for a bad DUT)
d) Calwarm fail accel bias outside valid range (ucontroller will provide this answer for a bad DUT)
Can someone help me to read the results by striping the multiline answered string from the READ buffer?
Is there any other better way to do it?
I need to display results on the front panel to visually tell the user also to save the results on a text file.
Anyone?
Thanks a million.
11-10-2011 12:00 PM
Sorry all who read my question.
Here is the vi.............(I forgot to attached)
11-10-2011 12:02 PM
That is certainly not a VI. Why did you post a hard to read image in some proprietary format instead of the actual code?
11-10-2011 01:01 PM
Dennis,
Thanks for answering. Attached find the code.
11-10-2011 01:58 PM
at least two subvi's are missing and this is not a program but a big sequenceframe.
please try to modularize your code.
You are flushing all eventual returns from the instrument and writing only waiting fixed times.
one possibility would be to have a subroutine that flushes, waits and writes a string.
with correct error in/out you don't need a sequenceframe anymore.
If the only problem is to read the multiline string I need to see the initialise port subroutine that is missing and
11-11-2011 06:54 AM
Albert,
Attached find the missing vi's. If you can modify your way without changing the sequence of the commands
I'll try myself with the actual DUT (device under test).
All 3 temperature cases will have almost the same code but the commands.
Thanks for your suggestions.
11-11-2011 09:12 AM
11-11-2011 03:51 PM
Albert,
The vi is more organize now but still the same problem.
Attached I'm sending you a print out of the hyperterminal resultant file,
It is what I'm expecting for response from this vi.
(sorry for the writings on the print out)
Thanks again.
11-12-2011 02:49 AM
Indeed the same problem, because I only reorganised to make clearer what happened.
I did not change the working of the code.
One of the things you can do is look at what you get back.
Only one line is interesting, the rest could be used as a check, that the instrument is still living.
The interesting line starts with "Cal Results, 00.0degC," including the comma at the end. But I doubt that it allways is 00.0degC, most of the time it should be a bit warmer...
But still "Cal Results," could be a good identifier of the correct line.
Use the Match Pattern function in the string palette to find out that that is the line and then use Spreasheet String to array on the last part of the string to get the numbers separated.
just try on that string and build a subvi that researches this string and yes or no retuns a result.
If you don't succeed send your subvi in again.
Programming is trying and thinking and making parts work correctly to get a real program.
For a moment just try to unerstand how to translate strings coming from your microcontroller.
Each line returns either information (in the form of an array of numbers) or no numbers at all, but a status.
So the ruturn should be an array of doubles and a status. A status could be an enum with cold/warm/data any name can be given.