PIC18 libraries replacements - package updated to v 1.12

General discussion on mikroPascal PRO for PIC.
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements

#31 Post by Dany » 12 Nov 2010 15:18

janni wrote:Not yet, Dany. Had to make more changes in strings lib after checking what the routines in official lib really do :roll: .
Ok. Thanks! :D
Last edited by Dany on 12 Nov 2010 15:39, edited 1 time in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements

#32 Post by Dany » 12 Nov 2010 15:39

janni wrote:I've noticed also how big the replacement lib became and how hard it may be to find desired procedure/function. Unfortunately, the way lib content is presented in Library Manager is a mirror of the order of routines in library unit (not, for example, the order of prototypes, which could easily be shuffled around :( ).
I'm still thinking how to solve this problem...
Why is this a problem? Are the routines normally displayed alfabetically perhaps?
Can "forward" declarations help in this?
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: PIC18 libraries replacements

#33 Post by janni » 12 Nov 2010 17:14

Dany wrote:Why is this a problem? Are the routines normally displayed alfabetically perhaps?
No, routines are not displayed alphabetically. Such an option could sometimes help, though only if one knew at least part of the searched routine name. In other cases it's much more convenient to users when the routines are listed according to some plan (like by type and conversion direction in conversions lib).
Can "forward" declarations help in this?
The "forward" declarations are not necessary in units as compiler has all info from prototypes in interface section, so order of routines is not critical for compilation. The order, however, is of importance when one writes, and especially when one corrects the code. Placing similar or dependent routines close together greatly helps and prevents mistakes.
The order of prototypes, on the other hand, has little impact on programming itself, so it could be used for Library Manager listings. As it's not so at the moment, I'll have to reorganise the souce code in such a way that it'll be both convenient for updates and make sense in listings.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

PIC18 libraries replacements - updated to v 4.15

#34 Post by janni » 13 Nov 2010 15:18

New version of replacement libs' package is ready and may be downloaded from here.

I've finally found a way to present large sets of routines in Library Manager which, hopefully, will be convenient for users (including myself :) ). The trick comes to use of dummy routines as separators and descriptions and proper organisation of routines. Library version may also be presented in this way though I left version strings for those that use them in code to ascertain that proper libs are used.

The libs have been updated to last compiler version, taking into account all (I hope) documented and undocumented changes to official libs. Two new routines have been added to the string replacement library, namely PosEx and PosExC. Practically all routines operate now on strings of any length. Exceptions were made only where it seemed that strings up to 255 chars will be sufficient - at the same time saving processor resources.

New replacement, the Delays lib, offers slight advantage in code size and more precise VDelay_ms and VDelay_Advanced_ms procedures, which should be less dependent on chosen processor clock.

Enjoy :) !

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements - updated to v 4.15

#35 Post by Dany » 13 Nov 2010 16:13

janni wrote:New version of replacement libs' package is ready and may be downloaded from here.

Enjoy :) !
Thanks! :D :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements - updated for mP v 4.15

#36 Post by Dany » 13 Nov 2010 21:10

Hi, FYI: this is what I use to switch over from Janni's replacement libraries to the original ones and vice versa.
Sometimes it is needed that I do tests of my own units/projects to see if they work with both the original mE libraries and the replacement ones.

The way of working is the following:

* first of all the replacement libraries and the original libraries are placed each in their own directory, here respectively

C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18\Lib Replacements Janni and
C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18\Lib Originals (pré Win7)

C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18\Lib Replacements Janni and
C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18\Lib Originals (Win7)

Do not forget to make and fill these directories before running the below batch files!

* 2 batchfiles are created, one to switch over to the replacement libraries (1) and one to switch back (2)

(1)

Code: Select all

@echo off
cd "C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18"
rem cd "C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18"

copy /b /y "Lib Replacements Janni\__Lib_Conversions.mcl" __Lib_Conversions.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_EEPROM_256.mcl" __Lib_EEPROM_256.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_EEPROM_1024.mcl" __Lib_EEPROM_1024.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_MathDouble.mcl" __Lib_MathDouble.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_String.mcl" __Lib_String.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_Delays.mcl" __Lib_Delays.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_Delays.mpas" __Lib_Delays.mpas >> nul
copy /b /y "Lib Replacements Janni\__Lib_Trigon.mcl" __Lib_Trigon.mcl >> nul
copy /b /y "Lib Replacements Janni\__Lib_Trigonometry.mcl" __Lib_Trigonometry.mcl >> nul

copy /b /y "Lib Replacements Janni\pic_additional_string_library.mcl" pic_additional_string_library.mcl >> nul

rem copy /b /y "Lib Replacements Janni\__Lib_System.mcl" __Lib_System.mcl >> nul
(2)

Code: Select all

@echo off
cd "C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18"
rem cd "C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18"

copy /b /y "Lib Originals\__Lib_Conversions.mcl" __Lib_Conversions.mcl >> nul
copy /b /y "Lib Originals\__Lib_EEPROM_256.mcl" __Lib_EEPROM_256.mcl >> nul
copy /b /y "Lib Originals\__Lib_EEPROM_1024.mcl" __Lib_EEPROM_1024.mcl >> nul
copy /b /y "Lib Originals\__Lib_MathDouble.mcl" __Lib_MathDouble.mcl >> nul
copy /b /y "Lib Originals\__Lib_String.mcl" __Lib_String.mcl >> nul
copy /b /y "Lib Originals\__Lib_Delays.mcl" __Lib_Delays.mcl >> nul
copy /b /y "Lib Originals\__Lib_Delays.mpas" __Lib_Delays.mpas >> nul
copy /b /y "Lib Originals\__Lib_Trigon.mcl" __Lib_Trigon.mcl >> nul
copy /b /y "Lib Originals\__Lib_Trigonometry.mcl" __Lib_Trigonometry.mcl >> nul

copy /b /y "Lib Additions Yo2Lio\pic_additional_string_library.mcl" pic_additional_string_library.mcl >> nul

rem copy /b /y "Lib Originals\__Lib_System.mcl" __Lib_System.mcl >> nul
The bach files are named respectively "___ReplacementLibs.bat" and "___OriginalLibs.bat" and reside in "C:\Program Files\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18" (pré Win7) or "C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for PIC\Uses\P18" (Win7).

* Shortcuts of both batchfiles are placed on the desktop for easy switch-over.

Additionally: mP must not be running when a switch over occurs.
Last edited by Dany on 05 Feb 2011 13:20, edited 5 times in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Briansw
Posts: 82
Joined: 28 Jul 2008 16:25

Re: PIC18 libraries replacements - updated for mP v 4.15

#37 Post by Briansw » 14 Nov 2010 02:15

Having some problems. I have your libs in "mikroPascal PRO for PIC\Uses\P18" and also yo2lio's libs also. I was using these on my latest project. Had some problems at first with getting Unresolved extern error messages but then for some reason everything started working good. Then just now I updated your libs with you latest release for Mppro 4.15 and now I'm getting the Unresolved extern messages again. Specifically these funtions are giving me error now.

319 303 Identifier "Str_Insert_Chr" was not declared enc_unit.mpas
0 360 Unresolved extern 'Str_Insert_Chr' enc_unit.mpas
0 360 Unresolved extern 'Str_Replace_Chr' enc_unit.mpas
0 360 Unresolved extern 'Str_Cut_Chr' enc_unit.mpas
0 360 Unresolved extern 'Str2Long' enc_unit.mpas
0 360 Unresolved extern 'Str_Split' enc_unit.mpas
0 360 Unresolved extern 'Str2Long' enc_unit.mpas
0 360 Unresolved extern 'LongInt2Str' enc_unit.mpas

Now my paths are set correctly and pointing to "mikroPascal PRO for PIC\Uses\P18" where the libs are stored but for some reason they are not being recoginized or something. Version of MpPro I'm running is 4.1 and not 4.15 as I did not upgrade because it was suppose to have been minor changes anyways. Also in my USES I have "pic_additional_string_library".



Update.... well reinstalling yo2lio's libs fixed the problem somewhat. I'm not getting Unresolved extern error messages anymore. Now only these two error messages.
491 438 Call signature does not match the function definition signature 'StrnCpy' enc_unit.mpas
501 438 Call signature does not match the function definition signature 'StrReplace' enc_unit.mpas

Any idea why?

Thanks again.
Bryan

Well guess I worked this out myself. Problem was StrnCpy(var S1,S2:string; size:word); where I had size:byte instead of size:word. Same goes for StrReplace too.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: PIC18 libraries replacements - updated for mP v 4.15

#38 Post by janni » 14 Nov 2010 03:21

Briansw wrote:Well guess I worked this out myself. Problem was StrnCpy(var S1,S2:string; size:word); where I had size:byte instead of size:word. Same goes for StrReplace too.
Yes, many routines were changed to accomodate strings of any size. All units using them have to be recompiled. Same concerns the official lib (StrnCpy is there, as well, with identical definition), even if not all changes are reflected in help.
Specifically these funtions are giving me error now.
319 303 Identifier "Str_Insert_Chr" was not declared enc_unit.mpas
...

Update.... well reinstalling yo2lio's libs fixed the problem somewhat. I'm not getting Unresolved extern error messages anymore.
Yeah, these routines were from Florins libs :) . I wonder, how you keep up with all those similar routines from different libs :wink: ...

Briansw
Posts: 82
Joined: 28 Jul 2008 16:25

Re: PIC18 libraries replacements - updated for mP v 4.15

#39 Post by Briansw » 14 Nov 2010 18:06

I started with Florins libs awhile ago and stuck with them. Maybe it is time to look into using the other libs if they have similar functions as Florins libs. I really haven't looked into them that much yet.

Thanks,
Bryan

Ok, just got rid of pic_additional_string_library in my uses and switch over to using the other libs with similar functions and all is working well. :D

Thanks again

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements - updated for mP v 4.15

#40 Post by Dany » 15 Nov 2010 16:56

Briansw wrote:I started with Florins libs awhile ago and stuck with them. Maybe it is time to look into using the other libs if they have similar functions as Florins libs. I really haven't looked into them that much yet.
Ok, just got rid of pic_additional_string_library in my uses and switch over to using the other libs with similar functions and all is working well. :D

Thanks again
I you use the ethernet libraries of Florin (which provide an IP stack!) then you will still need 4 functions out of pic_additional_string_library. This pic_additional_string_library with only those functions is also in the set of libraries provided by Janni. It works toghether with the replacement libs from Janni.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements - updated to v 4.15

#41 Post by Dany » 15 Nov 2010 19:48

janni wrote:New version of replacement libs' package is ready and may be downloaded from here.

I've finally found a way to present large sets of routines in Library Manager which, hopefully, will be convenient for users (including myself :) ). The trick comes to use of dummy routines as separators and descriptions and proper organisation of routines. Library version may also be presented in this way though I left version strings for those that use them in code to ascertain that proper libs are used.
Looks very nice in the Library manager!
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

piort
Posts: 1379
Joined: 28 Dec 2005 16:42
Location: Laval,Québec,Canada,Earth... :-)
Contact:

Re: PIC18 libraries replacements - updated for mP v 4.15

#42 Post by piort » 16 Nov 2010 16:31

A big thx to janni for this update !!! That work like a charm ! I love his conversion and math lib ! I save a lot of time and memory to have string display like a want on LCD and GLCD with those libs.

Thx to share and Gratz for this nice work !!!

;-)

sem
Posts: 12
Joined: 27 May 2009 11:08

Re: PIC18 libraries replacements - updated for mP v 4.15

#43 Post by sem » 25 Nov 2010 17:49

I'm sorry but i don't understand how to replace/Install the dany libraries.
Copy and paste in the P18 folder ?


Anothe questio in the P18 folder there is a original lib " __Lib_Math.mcl"
Why this library does not appear in the library manager ?
Please help me... :oops:

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: PIC18 libraries replacements - updated for mP v 4.15

#44 Post by janni » 25 Nov 2010 19:11

Hi sem,

Some libs contain the basic code that compiler uses to transform higher-level language into assembly. Libs like System, Math, or MathDouble are used by the compiler itself and are not meant to be directly accessed by programmers. Therefore, they're not listed in Library Manager.

As for replacement libs, as the name suggests, they're supposed to replace the original libs. So, one should change the names of the originals (like replacing the *.mcl extention with *.old or *.mE) and then move or copy their replacements to the Uses/P18 subfolder.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: PIC18 libraries replacements - updated for mP v 4.15

#45 Post by Dany » 25 Nov 2010 20:36

sem wrote:I'm sorry but i don't understand how to replace/Install the dany libraries.
Copy and paste in the P18 folder ?
Hi Sem, please see http://www.mikroe.com/forum/viewtopic.p ... 63#p137763.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal PRO for PIC General”