03-22-2010 08:08 AM - edited 03-22-2010 08:14 AM
Good job, it looks great, glad to see you're using a "wait until done" loop. Keep in mind, that "27" in the loop simply makes the loop wait 28*0.02 = 560mS. So you have a safety timeout of ~560mS. The "27" has nothing to do with your original "27" you had wired to the read. Not that it hurts, but it just seems coincidental that you used the same number.
The sequence structures are completely unnecessary in cases 1 and 2. You have a wire that connects the "frames" together, so the frames are not needed. Get it?
Message Edited by Broken Arrow on 03-22-2010 08:14 AM
03-23-2010 10:46 AM
I used 27 as i'm expecting 27 characters to be clocked through my loop. (27 is the loop iterations i want to get to)
I have made some changes, but i notice that my recieve frequently gets out of sync which messes up my data as i index the recieved string to get my numbers.
The microcontroller is running a 200ms loop but will only send data when it recieves "WE" which i want labview to send every 500ms or so.
I have attached the new code. Any ideas on my sync issues ?
03-23-2010 11:34 AM
You are stopping your loop if the Bytes at port is greater than 0. Suppose only some of your 27 of your bytes have come in during that interval. The loop will stop, it will read those x number of bytes, and you data will look corrupted because because you are missing bytes.
It is generally never necessary to consistently flush the serial buffer. If you happen to flush it in the instant before the remaining of the 27 bytes have been received, then you will wind up with with the last couple bytes remaining in the buffer for the next time the whole loop iterates.
You also have a potential race condition in your writing to file. You have two Write to Spreadsheet files. One before the inner True case and one inside the inner true case. Which one do you want to execute first? As it is, either one could execute first because neither one is dependent on waiting for the other to start or finish executing before it runs. If instead of splitting the file path wire, you wired it out of the first Write to Spreadsheet file before sending it into the inner true case, then you can guarantee the one outside must finish executing before th inner true case executes.
03-23-2010 11:44 AM
Thanks for the info,
so if i get rid of the >0 stop in the loop, so it will only stop if the data >27 or = 0 that should sort out my sync problems ?
Also regarding the write to file case structures, i want to exicute the inner case just once (this creates colum titles) then exicute the outer one everytime the timeout occures (to write data to the file)
Thanks, Zac
03-23-2010 11:48 AM
03-23-2010 11:50 AM - edited 03-23-2010 11:54 AM
03-23-2010 11:58 AM
Wow, it works perfectly now ! thanks for that, i've been chasing this problem for hours !
Thanks, Zac
03-24-2010 11:35 AM
Having said that.....
i have compiled it to en exe and it wont find the comport, are ther any extras i need to include in the install ?
03-24-2010 11:57 AM
03-24-2010 12:05 PM