‎04-22-2014 05:43 AM
Hey guys 🙂
Before i start i apologize for my bad English, i'm a student in Portugal in Eng. of Eletronics and Computers, and i have this last project to make, while working on an interprize here in Portugal that manufacters eletronic components for cars, home machines, etc.
Without going into much details that doesnt matter, my project is basicly read some valors from some sensors, and send that data with xbee to the Labview, so i can manage to register every data, and later make warnings about it, cause those sensors are currently used to control and monotorize one line of machines that use a lot of liquids with diferent temperatures and pH
Right now i'm just using the DS18B20 sensor from One-Wire, just to make things simple
I've manage to put the code on the arduino, that is connected to my xbee label as router AT (transmitter), and i have another xbee connected with my pc, label as coordinator API (receiver of information).
I've already managed to configured the 2 xbees with no problem, and they are currently passing info from one to another, as i show you in the pic of x-ctu.
I even managed to read the data on the Labview
my real problem now is that i dont really have a clue how to parse the string, or divide it so i can read only the valors that i need, in this case, temperature valours. As i hope you are familiar, the xbees send their data em Hex or ASCII code (correct me if i'm wrong but those are the ones i'm getting), and so my string kinda starts with a start byte (7E) so i managed to find the beggining and ending of my string sended, and even managed to identify the Hex code that holds the information of the valours of temperature received.
My real real issue is how to manipulate the string, so i can pull only the data i want (temperature numbers) and discard all the rest.
Here i'll send you some shots, my currently VI.
If you need any more details, like the configuration of the xbees i can provide it, although i dont think its relevant since they are working fine.
cheers to all!
‎04-22-2014 09:15 AM
Is the area in green the data you want? Does it always come in the same place in the data string?

‎04-22-2014 09:35 AM
Yes, it always come in the same location, i'll try to explain here:
the code for 1 reading is like this one
7E 00 13 90 00 13 A2 00 40 A2 3A 63 C0 DD 01 32 32 2E 36 39 0D 0A 85
this is received in labview as ASCII code, so basicly the information i want is the 32 32 2E 36 39, that corresponds to 22.69 for example (its the valor of my temperature). basicly 2 numbers for each character in ASCII code
but if i right click on the buffer (string readed) and change the mode to Hexadecimal it appears to me like this:
7E00 1390 0013 A200 40A2 3A63 C0DD 0132 322E 3639 0D0A 85
and i'm afraid that without the spaces it may even damage my information
what i really want is to learn how to clear everything else but those 5 pairs of numbers
from 7E00 1390 0013 A200 40A2 3A63 C0DD 0132 322E 3639 0D0A 85, extract this: 32 32 2E 36 39 and convert it to: 22.69
thanks in advance for you time, if you need more details please tell me so I can provide it the best way i can
🙂
‎04-22-2014 09:35 AM
‎04-22-2014 09:37 AM
Also, i forgot to mention
since its in a while cycle it continues to read the valors, so i also need to find a way to stop it, or do a reading, register it into something (an array would be great, but since i cant even extract nothing from it, dont know how to do it), clear the buffer, and do the reading again
the final propuse of the program is to do 1 reading per minute for example, from the sensor that flows trough the xbee
‎04-22-2014 09:43 AM
First of all, thanks again for the great help 🙂 you rock mate!
as for the type of reading of the temperature, yes it does always comes like XX.XX, at valors like 9.99, it would be displayed like 09.99, again, always like XX.XX. as for the 100.00 dont worry about it, the place where i'm working would only reach a max temperature reading of 75-80ÂşC.
And yes, it will always be as XX.XX
this kind of reading is from my program in arduino that is connected to my xbee router AT. I can change it to only have 1 decimal number, or even more than 3, so it would be like XX.X or XX.XXX doesnt matter, because the xbee only codes like 1 number or char at a time in ASCII code, so for each number it will always have a XX code
‎04-22-2014 09:45 AM
the part of my VI that displays those elements, it was my failed atempt to check the index of the string (as if it was an array) to pull the numbers i did want
‎04-22-2014 09:47 AM
‎04-22-2014 09:56 AM
Thanks for the help, learning everyday :)!
the problem to make a terminal char at the end of beginning of the information i want, and pull it out with a string, is that it cant be modified within the xbee, the xbee creates its own type of string ( xx xx xx xx xx... and so on), the last byte is always called the checksum, right before those 2 pairs of values that you spoke, but even it seems to change, and it should not (thats what the manuals say, so not sure of it)
but i'll try to do something more, thanks again for everything
‎04-22-2014 09:57 AM
@Raknugar wrote:
7E 00 13 90 00 13 A2 00 40 A2 3A 63 C0 DD 01 32 32 2E 36 39 0D 0A 85
0D 0A marks the end of the message. 85 is the start of the next message.
@Raknugar wrote:
but if i right click on the buffer (string readed) and change the mode to Hexadecimal it appears to me like this:
7E00 1390 0013 A200 40A2 3A63 C0DD 0132 322E 3639 0D0A 85
and i'm afraid that without the spaces it may even damage my information
The spaces are not really there. The spaces are only in the display and not in your string. The spaces are only there to make it easier for YOU to read them.