K-IDE support forum
Find all information about Kawasaki's Integrated Development Environment

Integer variable

#1 by Lomba1986 , Fri Jun 21, 2024 1:38 pm

Dear all,
I have a question about command Bits32 that save data into Integer variables t

This kind of variables seems that is not possible convert in another type and at the end this command BITS32 seems complete useless.... but I think that the Kawasaky team iomplementes something without a purpose.

A lot of my customer send data (or ask data) on fieldbus and use 32bit to communicate (ex: long integer, float...), so this command would be very usefull, but I don't know how use correcly.

Please, may you help me?

Thanks so much



 
Lomba1986
Posts: 27
Date registered 06.21.2024

Last edited 06.21.2024 | Top

RE: Integer variable

#2 by cquante , Mon Jun 24, 2024 6:31 am

Dear Lomba,

you are right, INTEGER values are not usable to directly calculate or convert. A colleague once wrote an AS program to convert 32 bit INTEGER values into REAL values. But it should be kept in mind that a REAL variable is not precise enough to store a 32 bit INTEGER value!


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


RE: Integer variable

#3 by Lomba1986 , Mon Jun 24, 2024 9:25 am

Thanks so much for your fast response.

The point is that some customer send via fieldbus datas using 32bits (ex: double or float or a long integer) so this command would be very useful...


 
Lomba1986
Posts: 27
Date registered 06.21.2024


RE: Integer variable

#4 by cquante , Mon Jun 24, 2024 12:22 pm

AFAIK data types such as long int (32 bit) and double (float) (64 bit) are not supported (yet). The only supported type is REAL (float, 32 bit). To communicate properly you have to convert the data to a manageable format.


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


RE: Integer variable

#5 by Lomba1986 , Mon Jun 24, 2024 4:00 pm

Yes you're right.
My question was how manage correctly the data that are trasmetted using 32bit.
At the moment the only command that convert this kind of data automatically is BIT32, but the integer type is complete locked and is not possible cast in another type.

Do you have some idea if and when Kawasaki will implements into the controller a command that convert automatically the 32bits data from decimal to binary (and viceversa) also in floating point?

Thanks in any case


 
Lomba1986
Posts: 27
Date registered 06.21.2024


RE: Integer variable

#6 by cquante , Tue Jun 25, 2024 9:00 am

It is on our (Kawasaki Robotics GmbH) wishlist since years: some more powerful variable types.

You don't need a converter, or better said: a converter alone will not make you happy. The "huge value" has to be supported by the AS system. If you "convert" a 32 bit integer into a 32 bit float you'll loose precision. If you calculate something with that converted value, the result will also not be very pecise.

To "convert" a 32 bit integer, maybe you can do the following:

  • Load the highword (16 bits) with the BITS function
  • Multiply the value with 32768
  • Load the lowword (16 bits) with the BITS function
  • Add both values (the multiplied highword and the lowword)

Keep in mind that the value you converted may be not the same as the value you received! A better solution will be to reduce the value on both sides of the communication to fit into 16 bits!


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


RE: Integer variable

#7 by Lomba1986 , Thu Jun 27, 2024 8:46 am

Dear CQuante,
forgive me if I'll seem arrogant to you, but do you not think that this way is too hardworking nowdays?
I work with other systems (among which 3 robot brands) and all convert directly 32bits from binary to decimal...

Thanks


 
Lomba1986
Posts: 27
Date registered 06.21.2024


   

Regenerate
Else / ElseIF statment



Xobor Xobor Community Software
Datenschutz