In Freelance 2000-CBF software, how can we convert two DWORD (32bit) to one Real 64 bit?
In the Library there is no function like "pack DWORD to QWORD(64 bit)". In our Totalizers the data are too large for the DWORD value.
Voted best answer
There is no direct conversion from QWORD to REAL, there is only a binary conversion from DWORD to REAL.
The Real data type in Freelance 2000 is only 32bit single Precision.
If you want to keep the high precision of the 64bit value, you are lost.
If you can live with losing some digits, you have to convert the 64bit double precision to 32bit single precision first.
There is also no build in function to do this, so you have to write one on your own. This appears possible, but very difficult.
The Real data type in Freelance 2000 is only 32bit single Precision.
If you want to keep the high precision of the 64bit value, you are lost.
If you can live with losing some digits, you have to convert the 64bit double precision to 32bit single precision first.
There is also no build in function to do this, so you have to write one on your own. This appears possible, but very difficult.
Answers
Why not cascade 2 or several up/down counter function blocks CTUD?
Today I remembered a similar problem we had years ago. While Freelance have a Pre-Build Analog Counter who works internal with 64bit, we need a Analog Counter on a Safety-Controller.
This old one can handle only 32bit Real and 16bit Integer Values, but we needed 64bit precision.
The solution was to split the counter in smaller parts (8x8bit), add / multiply all parts separate, add overflows and so on. This looks very strange, but worked well.
Maybe you will find inspiration in the attachment.
This old one can handle only 32bit Real and 16bit Integer Values, but we needed 64bit precision.
The solution was to split the counter in smaller parts (8x8bit), add / multiply all parts separate, add overflows and so on. This looks very strange, but worked well.
Maybe you will find inspiration in the attachment.
Add new comment