4
Answers

Splitting the data received from serial port

Ask a question
Samuel Vaesy

Samuel Vaesy

16y
8.6k
1
Hello,


I'm having a problem trying to solve how to split data received from serial port. The basic idea is to receive measurement data from serial port and then save it to .xml file.

So far I have other "modules" in my software working but I haven't yet figured how to split the data and save it to the .xml file properly. The data I receive is a list of measurement values separated by comma and with start and stop letters. length and form of the received data will be always same, only measurement values change...

So it'll look like this: &,24,21,53,54,33,24,36,37,54,33,33,22,33,23,$

How should this be splitted so that it would be easiest to save to .xml file?

form of the .xml file is something like:
<sensor1>
<name>temp1</name>
<value>"first received value"</value>
</sensor1>

I'm quite new to C#, previously I have coded only C-language and some HTML stuff, so my ideas might have been a bit too "conservative" ;)


- Vertti

Answers (4)