PIC18 libraries replacements - package updated to v 1.12

General discussion on mikroPascal PRO for PIC.
Author
Message
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)

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

Re: PIC18 libraries replacements - updated for mP v 4.15

#46 Post by janni » 29 Nov 2010 14:20

sem wrote:Ok... I would like to know how to use the "unofficial" unit of mikropascal pro.
I had unzipped and copy to the P18 folder.
Now , i use in a "uses" part, " uses __Lib_Conversions,__Lib_MathDouble, fpmath;"
I can see the new functions in the library manager, but there is not the MATH functions in the library7 manager.
Why? Where i can found int, trunc, round functions ?
Thanks, Sem
You only need to include the FPmath lib in a uses clause. You'll have access to all it's routines, even if you do not see them in Library Manager. All other libs are replacements, so they're known to compiler and governed by Library Manager.

To have the FPmath lib treated in the same way, i.e. visible in Library Manager, you'd have to modify the .mlk file of the processor you use. It's described in Help, but I'll try to make it easier for you.

Find in mP installation directory a subdirectory called Defs. There you'll find the .mlk file of your processor. Lets assume you use PIC18F4620. It's file is called P18F4620.mlk. Open it in simple text editor, like Notepad, and you'll see the details of processor description. Search for LIBRARIES. Every lib appropriate for this processor is listed with it's filename, alias and category (SYSTEM or REGULAR). All you need to do is to add the following

Code: Select all

		<LIB>
			<ALIAS>FP_math</ALIAS>
			<FILE>fpmath</FILE>
			<TYPE>REGULAR</TYPE>
		</LIB>
to the file (best at the end of libs list, just before </LIBRARIES>). After such modification you won't need to add FPmath to uses clause - checking it in Library Manager will be enough.

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

Re: PIC18 libraries replacements - updated for mP v 4.15

#47 Post by sem » 30 Nov 2010 15:03

WONDERFULL !!!
Thanks Janni. :D

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

Re: PIC18 libraries replacements - updated for mP v 4.15

#48 Post by janni » 01 Dec 2010 00:47

Conversions lib has been updated (v 1.08) as Dany noticed that space was added instead of zero in some ...2StrWithZeroes routines. The whole package of replacement libs is available as before here, but it's enough to replace just the __Lib_Conversions.mcl file.

Post Reply

Return to “mikroPascal PRO for PIC General”