06-23-2011 03:41 PM
@CrackJack wrote:
so, my question is, is there a way though which I can mark an "end of data" stream byte or send such a byte in labview?
thanks,...
Why not just use a special control character of your choosing? How about NULL (0x00)?
06-23-2011 03:51 PM
there might be lot of times, when the data i am sending would contain NULL (0x00) value but i got your point, i can simply send a "End of Data Char" and keep on cheking in my uC if i get that..
06-23-2011 04:22 PM
If you are sending ASCII type of data, then using a special character such as a line feed (x0A) or a null (x00) is a good way to go. If you are sending binary type of data where a byte could be any value, then you can't use a special character. So the best way then is to setup up your messages so that the data is prepended with 1 or more bytes (always the same number) that reflects how many more bytes follow. So you read a byte, let's say it is 32, then you keep reading until you receive 32 bytes. If you want a full fledged protocol, you could also have special bytes that might be a start byte, end byte, a checksum, etc. So a typical package of data might be Start byte, 2 bytes for number of bytes to follow, your data package, perhaps 2 bytes for CRC-16 checksum, then and ending byte.
06-24-2011 04:10 PM - edited 06-24-2011 04:15 PM
@All, thanks for all the suggestion, i am almost to the end of my program.. except 1 last hindrance...
I chucked the idea of saving byte by byte and now writing the entire bytes as they come, but new problem is;
in my uC code, and stop the code at the line no. where this '#' is being transferred from TXBUF and increment the program counter step-by-step, labview then understands this 1 '#' byte...
what could be happening?
06-24-2011 04:36 PM
Post this section of code that processes the # character in LV.
06-25-2011 11:52 AM
hello, please check the attached file... the sequence "check if "#' character is sent by micro-controller to mark end of data stream" is connected to the STOP button of the while loop, which basically means
if labview finds #, the Match True/False String.vi will return a TRUE value, which could end the while loop (connected as STOP IF TRUE).
06-25-2011 12:06 PM
You are writing the entire string you receive to the file. You are detecting whether the string contains a "#", but you aren't doing anything to break the string there to only write the portion of the string up to the "#".
06-25-2011 11:49 PM
@Raven's Fan, i have connected the output of the Match True/False String.vi to the control logic of while loop, so that whenver '#' is detected, the Match True/False String.vi returns a true, which stops the entire labview program... attached is the file...
did i answer your question, is this what you wanted to know??
06-26-2011 12:52 AM
No, RavensFan is talking about detecting the received string before the file write. In other words, only write those characters you need to the file. You don't need to write the '@' or '#' control characters. Your detection code doesn't need to be in the sequence structure either.
06-26-2011 02:22 PM
everyone, i solved that problem. but now have a new problem...
Labview gets hanged when i transfer more than 256 bytes from my uC to PC. does this have to be because of some internal buffer? because 2^8 = 256, so, i thought if this would be related to some internal buffers?? I want to transfer 1GB data from uC to PC.