I ran into troubles with that method on ARM processors which only allow reals when they are alligned to a memory address divisible by 4. the rValue := prValue^; causes an access violation.
Instead use either a memCpy or a byteBuffer. with bytebuffer you even have the option to do byteswapping.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello,
i'm new in coding with codesys
is there any help about how to convert array of 4 byte to real
thank you for your support
It depends. First you need to know more about the exact format.
Is it a 32bit IEEE floating point number, which is just packed into an array of 4 bytes?
Then, s.th. like this:
Actually you use pointers to the data to cast it to the correct data type.
I ran into troubles with that method on ARM processors which only allow reals when they are alligned to a memory address divisible by 4. the rValue := prValue^; causes an access violation.
Instead use either a memCpy or a byteBuffer. with bytebuffer you even have the option to do byteswapping.