I'm trying to transfer my programs from Microchip XC8 to MIKROC PRO. In the XC8 I'm reading from EEPROM a Double which is in hex 0x00 00 60 40, that was in XC8 the float 3.5. Can anyone help me with the MIKROC version: how I'm I suppose to save it in EEPROM? The old 0x00 00 60 40 as shown in Watch Window of the ICD Debugger is NOT 3.5 neither the 0x40 60 00. How are float numbers laid in memory little or Big Endian?
Thank you
XC8 to MIKROC migration
-
- Posts: 5
- Joined: 20 Jul 2020 14:52
Re: XC8 to MIKROC migration
Update:
I've checked with the ICD the Hex value of a variable set to 3.5 is 0x80 60 00 00. In the Help it says: <<Floating point in the mikroC PRO for PIC is implemented using the Microchip AN575 32-bit format (IEEE 754 compliant)>>.
An online hex calculator entering the 3.5 gives 0x40600000 (https://www.h-schmidt.net/FloatConverter/IEEE754.html). For the value of 33000.0 ICD gives 0x8E 00 E8 00 but the IEEE 754 format shows: 0x4700e800.
Can anyone tell me what format MIKROC is using?
I've checked with the ICD the Hex value of a variable set to 3.5 is 0x80 60 00 00. In the Help it says: <<Floating point in the mikroC PRO for PIC is implemented using the Microchip AN575 32-bit format (IEEE 754 compliant)>>.
An online hex calculator entering the 3.5 gives 0x40600000 (https://www.h-schmidt.net/FloatConverter/IEEE754.html). For the value of 33000.0 ICD gives 0x8E 00 E8 00 but the IEEE 754 format shows: 0x4700e800.
Can anyone tell me what format MIKROC is using?
Re: XC8 to MIKROC migration
mC uses little endian for storing numbers BUT floating-point numbers are stored in Microchip notation, not IEEE 754, like in XC8. The IDE contains Quick Converter where one may compare the formats.
EDIT: your second post was apparently delayed (first few posts usually are) so I haven't seen it before writing the above. If you need the details of Microchip format, see here.
EDIT: your second post was apparently delayed (first few posts usually are) so I haven't seen it before writing the above. If you need the details of Microchip format, see here.
-
- Posts: 5
- Joined: 20 Jul 2020 14:52
Re: XC8 to MIKROC migration
Thank you Janni.
Apparently Microchip itself is NOT using its notation. The code I have and is working and tested in nearly a thousand devices represents (in XC8) the 3.5 as 0x00006040 (IEEE754) and NOT as 0x80 60 00 00 (Microchip notation).
Nevertheless, I will change the code following this notation. It is a migration attempt anyway.
The most interesting part is due to come, trying the Visual TFT with an LCD display.
Best Regards
Apparently Microchip itself is NOT using its notation. The code I have and is working and tested in nearly a thousand devices represents (in XC8) the 3.5 as 0x00006040 (IEEE754) and NOT as 0x80 60 00 00 (Microchip notation).
Nevertheless, I will change the code following this notation. It is a migration attempt anyway.
The most interesting part is due to come, trying the Visual TFT with an LCD display.
Best Regards
Re: XC8 to MIKROC migration
Indeed. It comes from an old f-p library that has some quirks (unfortunately not corrected in mE compilers) from the times of mostly assembly programming. Still, the library is more compact and several times faster than the one used in XC8.
-
- Posts: 5
- Joined: 20 Jul 2020 14:52
Re: XC8 to MIKROC migration
YES!! That's why I've took the decision to swift to MIKROC.janni wrote: "...library is more compact and several times faster than the one used in XC8"
The true confusion is with the PIC32 Harmony. Harmony is a Greek word and Microchip managed to invert its original meaning, it made it synonymous to chaos.
That will be my next step to change all my programs from Harmony to MIKROC for PIC32. I foresee a large volume of work (since the programs are huge) so I'm delaying it for now.
Re: XC8 to MIKROC migration
Just keep in mind that professional applications are not the target of mE compilers (hence the comparatively low price) so neither the compilers nor libraries are scrupulously tested, nor are any discovered quirks or bugs quickly fixed (or properly described). One also has to tolerate sometimes overlong implementation times of new processors. Having a look at some forum topics, like this one could be beneficial.ktarchanidis wrote: ↑29 Jul 2020 12:37That will be my next step to change all my programs from Harmony to MIKROC for PIC32. I foresee a large volume of work (since the programs are huge) so I'm delaying it for now.
There's one thing more - at the moment mE transitions to NECTO studio so support of present compilers is hampered and will stop at some point. Better get a look at NECTO as it's quite a different experience.