Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

MOBOT steering problem

Solved!
Go to solution

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?

0 Kudos
Message 11 of 29
(1,562 Views)

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!

 

Best regards,
Jano
0 Kudos
Message 12 of 29
(1,560 Views)

thanks 🙂

0 Kudos
Message 13 of 29
(1,558 Views)

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

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 14 of 29
(1,553 Views)

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.

0 Kudos
Message 15 of 29
(1,545 Views)

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

 

0 Kudos
Message 16 of 29
(1,537 Views)

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.

0 Kudos
Message 17 of 29
(1,533 Views)

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

  

0 Kudos
Message 18 of 29
(1,530 Views)

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

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 19 of 29
(1,525 Views)

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

0 Kudos
Message 20 of 29
(1,523 Views)