PLUS+1 Tools > PLUS+1 GUIDE

Input hexadecimal???

<< < (2/4) > >>

Marbek_Elektronik:
Hello Ebby,
about your first picture 1. jpg:

Please consider the data format: you can't compine S8 with S8  to S16, and S16 with S16 to S32.
I didn't try it. But it can't work.

The data from Can bus is at first U8
Then you can combine U8 with U8 to U16, and U16 with U16 to U32.

Ebby:
The data is sent by load cell digitiser as a can message in mV per volt and is a float (eg. 0.0420848 ) and received by RX
I am trying to implement some code we found for "FLOAT TO INT"  as attatched. We can see all raw data at checkpoints up until the FLOATTOINT  function block but nothing after.
We have come a long way in the last month with PLUS1 but this one has us really stuck.
Any input at all is very much appreciated.

jashom1:
Hi Ebby,

I am assuming that you mean you are getting nothing that you are getting zero back from trying to convert a float of 0.0420848

That block will only give you the integer part of the float (which is zero), and not the fraction part which is what you want.

This website will give you some understanding on floats, but they definately mess with my head trying to convert them to real numbers, which would be nice if Danfoss could supply a block that would return an integer from a float with some nice resolution, say multiplied by 10000, or even a configurable resolution  ;)

https://www.h-schmidt.net/FloatConverter/IEEE754.html

Sorry I haven't got any good news for you!

John.

jashom1:
Second thoughts, you can actually get some good resolution if you use the float multiply block, and multiply the float before converting it to a real number.  You just have to be careful of over flowing.





Cheers,

John.

FluidPowerTom:
Ebby, you're correct that within the Call POU (Structured Text) block you can do floating point aka real data types.  However, you cannot output that data type, so you will have to convert back to some type of integer if that signal needs to go back outside of the Call POU.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version