06-29-2011 05:25 AM
I found the problem but I haven't found the solution. It looks like Number to Hexadecimal String gives me wrong results. For example when I want to convert decimal 100 to hex I get 3634 (hex). Don't know why. Any ideas?
06-29-2011 11:13 AM
Hi,
I'm sorry, but I probably won't be able to look into your problem until monday since I'm out of town (I don't have LabVIEW installed on the computer I'm using at this moment), untill then, I'll ask a colleague to take a look into your problem.
Have a nice day!
06-29-2011 11:15 AM
thanks 🙂
06-29-2011 12:28 PM
Could you please post why do you think number to hexadecimal string gives wrong result?
1) What do you pass into the function "number to hexadecimal string" ?
2) What do you get as result ?
3) What do you expect as result ?
I believe to answer those questions should be pretty helpful when looking for how to help you 🙂
regards,
stefo
06-30-2011 05:26 AM
It looks like this:
I put decimal number to "number to hexadecimal string", e.g. 100. In a result I get 3634 hexadecimal. I expect the hex number to be 64. Probably its small mistake, but I can't find it at the moment. I appreciate your advice.
07-01-2011 02:04 AM
Hi,
Your problem resides from the indicator's representation.
If your string indicator is set as normal display, you will receive the expected result 64 for 100 decimal,if your indicator is set as hex display, it will retrieve 3634 (64 in ASCII).
If you simply would like to send 64 in Hex, create a control and change it's display format accordingly (eventually, everything is just a sequence of bits).
Please find my attached simple VI. It could answer your questions,
Mircea
07-01-2011 03:34 AM
Mircea thank you for your answer.
I don't know if I understand it correctly. Do I have to simply change display representation to 'normal display'? Why does 'hex' representation show numbers in ASCII rather than hex? I am used to code programming, and that's a bit weird for me.
07-01-2011 03:49 AM
Hi,
When using number to hexadecimal string, what is actually happening is:
You have a numerical input (ex I32). You set it's value to 100. The bits representing 100 go through "Number to Hexadecimal String" and will output string, representing the hexadecimal value of the inputted I 32.
so: you input 100 , the function outputs a string: first character in the string is 6 and the second character is 4. (normal representation - ASCII)
If you change to HEX Display, it will be shown the HEX representation of character 6 and the HEX representation of the character 4. (3634)
I would recommend you focused more on the numeric control to numeric indicator part of my VI to understand that it is just a matter of representation, what actually matters in the message you send is the bits.
Please spend some time analyzing the bits you are really sending (a good practice is to have hex representation for everything (controls, indicators, constants)) so that you can create the proper bit sequence to control the MOBOT.
Please let us know your progress,
Mircea
07-01-2011 04:01 AM
Ok bikekowal,
in your VI you have your strings displayed as HEX strings (hex display for each character).
For example, string called "concatenated string 2" - if you right click on it and set "Normal Display", then if speed is 100, you receive "FC0A6464", while Hex display will show "4643 3041 3634 3634".
Here we are just talking about how to display the data - but in fact you need propably something more to make your code working. Could you specify what exactly do you need to get and in what data type to make you robot moving as desired?
regards,
stefo
07-01-2011 04:20 AM
Stefo,
As I wrote before, what I need to do is to send frame that looks like this (in hex):
FC
0A
speed 1
speed 2
where speed 1 and speed 2 are some values between 1 and 100 (one direction) and between 101 and 200 (another direction). So the whole frame should look like this e.g. FC0AC8C8 (if speed1=speed2=200). What I need to do is to controll the speed with e.g a slider and send this frame to serial port. Basically the only problem now is to send a calculate a proper frame.
regards,
Marcin