Shaiq Bashir Posted June 20, 2008 Report Share Posted June 20, 2008 Hi guys! i spent quite a lot time in searching in these forums to know exactly what i want. but i couldnt understand somehow. thats why posting it. I have connected my labview vi with my PIC microcontroller. The piC is sending it a sensors data continuously in the form of data stream like the following u253vx132y this stream gets updated at regular intervals so this 253 and 132 actually represents sensors data. currently im using match pattern function of strings to separate 253 and 132 and then performs some maths operation on them. sometimes the stream gets this form u25vx132y now if you compare the above two data streams , the first one is of 10 bytes and second one is of 9 bytes. this puts me thinking ke what to keep the value of byte count . then i think to use a termination character. but im unable to use it. i tried all the methods but it dint work. please tell me how it works. im using a serial monitor program, i put \n as a termination character, but when i send a string from it like hello\n it doesnt seem to terminate. Please tell me how to do this Quote Link to comment
crelf Posted June 20, 2008 Report Share Posted June 20, 2008 QUOTE (Shaiq Bashir @ Jun 19 2008, 12:32 PM) u253vx132ythen i think to use a termination character. but im unable to use it. i tried all the methods but it dint work. please tell me how it works. im using a serial monitor program, i put \n as a termination character, but when i send a string from it like hello\n it doesnt seem to terminate. Please tell me how to do this You could use the last value in the string as a termination character - is it always y? Quote Link to comment
Shaiq Bashir Posted June 20, 2008 Author Report Share Posted June 20, 2008 QUOTE (crelf @ Jun 19 2008, 09:48 PM) You could use the last value in the string as a termination character - is it always y? its not working sir. im posting my file here. please check it out. Yes it will always be "y". but remember that the problem is this that the values in between can be of 1 digit ,2 digits or 3 digits, so byte count is creating problem for me. please help me Quote Link to comment
crelf Posted June 20, 2008 Report Share Posted June 20, 2008 QUOTE (Shaiq Bashir @ Jun 19 2008, 01:38 PM) its not working sir. im posting my file here. please check it out. Yes it will always be "y". but remember that the problem is this that the values in between can be of 1 digit ,2 digits or 3 digits, so byte count is creating problem for me. I haven't been called "sir" since I was in the military You can set the byte count to something higher than what you'd expect. The read will wait until it gets the number of bytes or the terminiation character, whichever comes first. Quote Link to comment
Shaiq Bashir Posted June 20, 2008 Author Report Share Posted June 20, 2008 QUOTE (crelf @ Jun 19 2008, 11:08 PM) I haven't been called "sir" since I was in the military You can set the byte count to something higher than what you'd expect. The read will wait until it gets the number of bytes or the terminiation character, whichever comes first. thanks for ur help. can u provide me any example plz Quote Link to comment
crelf Posted June 21, 2008 Report Share Posted June 21, 2008 QUOTE (Shaiq Bashir @ Jun 19 2008, 05:14 PM) thanks for ur help. can u provide me any example plz Search the help - you should be able to find something in there about termination characters. Quote Link to comment
bbean Posted June 21, 2008 Report Share Posted June 21, 2008 QUOTE (Shaiq Bashir @ Jun 19 2008, 12:32 PM) now if you compare the above two data streams , the first one is of 10 bytes and second one is of 9 bytes. Why don't you just parse the string to get the two numbers out Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.