Delays library replacement offers slight advantage in code size and decidedly more precise VDelay_ms and VDelay_Advanced_ms procedures, which are less dependent on chosen processor clock.
As the source is provided and all but one routine have same prototypes as the original, there was no need to prepare a separate documentation for this library. The additional routine, VDelay_us, allows to obtain variable delays in sub-millisecond range. It's been written in assembly, but it still has some limitations. Real 1us resolution and accuracy may be achieved only with clock frequencies in excess of 16MHz. You'll find additional information in the source file.
Strings library, prepared some time ago with yo2lio's help for PIC18 processors, has been later ported to mP PRO and expanded quite a bit by adding several Delphi-like routines.
The replacement routines are more effective, both in size and in execution time, than the
originals - that was the main reason to write them.
For those that use Florin's Ethernet libs a small library was added that should be used
instead of his Additional Strings Library (which cannot be used in parallel with the
Conversions lib replacement).
It contains just few routines that differ in naming from the Strings lib
replacement and are needed by Ethernet libs. It's naturally called the same as original (
pic_additional_string_library.mcl) as the Ethernet libs search for it.
C_Stdlib library replacement contains two pseudo-random functions from the original library. It was introduced to make use of these functions possible as there was a conflict between the abs function contained in the original library and similarly named function in Math replacement library.
Naturally, I could not do anything about the fact that compiler never calls signed multiplication routines for 16- and 32-bit integers (the routines are there, compiler simply does not call them as, due to errors in original signed routines, unsigned multiplication routines are called instead).
Note that problems with modulo operations, besides leading to wrong results, lead also to
discrepancies between compilation-time calculations and runtime ones.
Some public routines were added to the Math library. Four of them help to exploit the
exception mechanism (or just use the status byte of fixed-point calculations). There are
also absolute value and square root functions as well as two additional execution-time
effective multiplication routines.
The library defines also constants representing integral types' range limits.
Floating-point math library replacement has also two versions - both produce smaller code than the official one and give more accurate calculation results by fixing problems that the official lib inherited from the original Microchip library, i.e.
Both versions give access to floating-point operations' status byte. One of them may generate 'exceptions', i.e. allows to write code that contains provisions for calculation errors (like overflow, underflow, or division by zero). The library requires presence of appropriate version of Math library replacement.
Read MathDouble lib documentationFloating-point functions libraries, Trigon and Trigonometry, were prepared to work
with MathDouble replacement of mE's system floating-point library (__Lib_MathDouble.mcl).
Please do not use them separately, i.e. with the original MathDouble lib.
Moreover, the Trigon library requires presence of other replacement libs, namely the
Strings and Conversions libraries.
Both f-p functions libs contain all the routines present in the originals (though differently distributed)
plus a set of routines that were formerly contained in an additional lib, called Fpmath
and distributed with earlier MathDouble lib replacement versions (up to v 0.07).
The replacement libraries produce smaller code than the originals, while giving more
accurate calculation results, and allow to exploit the exception mechanism from
Math and MathDouble lib replacements.
Detailed differences from the originals:
Due to introduction of rounding while converting to integer types (in both implicit and
explicit conversion), use of the replacement libs may require older code correction,
as with the official MathDouble lib conversion was based on truncation (the fractional part
of real number was simply omitted). This issue is addressed by introducing a set of useful
routines to the Trigon library – one of them, Trunc, may be used whenever rounding is not
wanted. (There is also Round function which does nothing more than explicit conversion but
was added for completeness.)
For clarity and ease of use, strictly trigonometric functions were moved from Trigon to
Trigonometry library. All functions contained in the latter are present in official
libraries and as such are documented in Help.
Apart from the programming language syntax, mB PRO is identical to mP PRO in all practical aspects, like program structure, language elements, libraries structure and contents (in fact almost all mB libs are written in Pascal and assembly). Therefore, precompiled replacement libs may freely be used with mB PRO. System libs, like System, Math or MathDouble will mostly work in background, and other libs require only understanding of their procedures and functions prototypes - and only those that are absent in original libs and thus missing from Help (and for the Delays lib replacement there is a source file in Basic). Replacement libraries documentation installed by LibsSwitch for mB PRO lists the prototypes in Basic.
For those that want to take a look at documentation for mP linked to on this page, here are few tips about the syntax differences:
- parameter passed by value Pascal bb: byte Basic dim bb as byte - parameter passed by address (reference) Pascal var bb: byte Basic dim byref bb as byte - parameters are separated by colons in Basic while in Pascal also semicolons are used Pascal procedure example(a1,a2: byte; var w1: word); Basic sub procedure example(dim a1,a2 as byte, dim byref w1 as word) - simple types' names are identical in both languages except for longword (dword) and float (real) - strings and pointers are declared in the same way in both languages while arrays a bit differently Pascal arr: array[5] of byte Basic dim arr as byte[5]Examples:
procedure CopyC(var Dest:string; Source: ^const char; Index,Count: word); sub procedure CopyC(dim byref Dest as string, dim Source as ^const char, dim Index,Count as word) function str2real(var inst: string[17]): real; sub function str2real(dim byref inst as string[17]) as real