PIC related website

General discussion on mikroPascal PRO for PIC.
Author
Message
Toley
Posts: 922
Joined: 03 Sep 2008 16:17

Re: PIC related website

#646 Post by Toley » 01 Nov 2012 15:22

Dany wrote:You can send me your project if you want
It is your example I did not change anything.
Serge T.
Learning is an endeless process but it must start somewhere!

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

Re: PIC related website

#647 Post by Dany » 01 Nov 2012 15:50

Toley wrote:My original goal is to try to translate it to C, but now I realize I will have to translate all the other modules before I can expect this to compile without error (and after debug it to try to make it work) it's a very long and hard task...
Well, I did some test to see if the Pascal library could be used directly by C and it seems to be not possible: apparently the routines "memset" and "memcpy" have a different call signature in mP and mC. :? Most probably there are more differences in the string libraries of the two compilers...

This means indeed that you will have to translate the lib to mC. :( :(

Anyway, I have made the .h file for the library, so, not all of my testwork was useless, see attachment. :D
Attachments
USB_HOST_MSD_Library.zip
The C header file for the USB MSD host library.
(990 Bytes) Downloaded 257 times
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: PIC related website

#648 Post by Dany » 01 Nov 2012 15:55

Toley wrote:
Dany wrote:You can send me your project if you want
It is your example I did not change anything.
Then my previous question still holds:
Do you use the adapted Fat32 driver file (http://www.rosseeld.be/DRO/PIC/__Lib_FAT32_Driver.mpas)? It contains the additions for the USB drive.
You should replace the __Lib_Fat32_driver.mpas (as I did) by the adapted one in the dspic packages library, or (perhaps better) place the adapted driver locally in your project and enter it in the project manager.

The problem is that the driver is part of the Fat32 Library of mE, not part of the USB MSD lost library...
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)

Toley
Posts: 922
Joined: 03 Sep 2008 16:17

Re: PIC related website

#649 Post by Toley » 01 Nov 2012 17:25

You should replace the __Lib_Fat32_driver.mpas (as I did) by the adapted one in the dspic packages library, or (perhaps better) place the adapted driver locally in your project and enter it in the project manager.
Yes this is what I did with your latest (today) update in Libstock. I replaced the one already include in the FAT32 package inside the dsPIC\Packages\FAT32 Library\Uses
Serge T.
Learning is an endeless process but it must start somewhere!

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

Re: PIC related website

#650 Post by Dany » 01 Nov 2012 20:28

Toley wrote:
You should replace the __Lib_Fat32_driver.mpas (as I did) by the adapted one in the dspic packages library, or (perhaps better) place the adapted driver locally in your project and enter it in the project manager.
Yes this is what I did with your latest (today) update in Libstock. I replaced the one already include in the FAT32 package inside the dsPIC\Packages\FAT32 Library\Uses
Odd.

If compiling stops with errors, then it is presumably in the "Fat32_Driver" unit. The top of that file shown then in the IDE must look like:

Code: Select all

unit __Lib_FAT32_Driver;

// USB Memory stick version (+ existing MMC version), 2012-09-30

{-$DEFINE MMC}        // choose one or the other  // <--------------------------------
{$DEFINE USB_STICK}   // here                     // <--------------------------------

uses __Lib_FAT32_Types, __Lib_FAT32_Defs, 
{$IFDEF USB_STICK}
  USB_HOST_MSD_Library
{$ENDIF}
;
Could yo verify that please?

And: at which line does the compilation stops? Or is it at linking time that the error occurs?

If above is Ok, then I can not guess any more what the problem could be... :oops:

p.s. I see that mE made the "Fat32_driver" unit dependant of the "mmc" library in the package manager. So, automatically the "mmc" and "spi" libraries are checked to "on" in the library manager after checking the Fat32_library libs.
Here this gives no problem at all.
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: PIC related website

#651 Post by Dany » 07 Nov 2012 21:22

Any progress?
Dany wrote:
Toley wrote:
You should replace the __Lib_Fat32_driver.mpas (as I did) by the adapted one in the dspic packages library, or (perhaps better) place the adapted driver locally in your project and enter it in the project manager.
Yes this is what I did with your latest (today) update in Libstock. I replaced the one already include in the FAT32 package inside the dsPIC\Packages\FAT32 Library\Uses
Odd.

If compiling stops with errors, then it is presumably in the "Fat32_Driver" unit. The top of that file shown then in the IDE must look like:

Code: Select all

unit __Lib_FAT32_Driver;

// USB Memory stick version (+ existing MMC version), 2012-09-30

{-$DEFINE MMC}        // choose one or the other  // <--------------------------------
{$DEFINE USB_STICK}   // here                     // <--------------------------------

uses __Lib_FAT32_Types, __Lib_FAT32_Defs, 
{$IFDEF USB_STICK}
  USB_HOST_MSD_Library
{$ENDIF}
;
Could yo verify that please?

And: at which line does the compilation stops? Or is it at linking time that the error occurs?

If above is Ok, then I can not guess any more what the problem could be... :oops:

p.s. I see that mE made the "Fat32_driver" unit dependant of the "mmc" library in the package manager. So, automatically the "mmc" and "spi" libraries are checked to "on" in the library manager after checking the Fat32_library libs.
Here this gives no problem at all.
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: PIC related website

#652 Post by Dany » 07 Nov 2012 21:29

Hi,

A new tool has been placed on the website: see http://www.rosseeld.be/DRO/PIC/tools.ht ... _convertor.

This is a tool capable of translating mP items to mBasic:

Procedure and function prototypes
Type definitions (including records)
Constant definitions
Variable definitions

Very handy in translating e.g. unit "interfaces" of Pascal libraries that will be used with the mB compiler. It gives you the signatures of the interface in a known language (here mBasic).

Perhaps this will encourage the usage of libraries made with mP by mB users. I saw that the mP and mB standard libraries are most probably the same, so mP units using these should also be usable in mB.

Any ideas are welcome.

Have fun! :D
Last edited by Dany on 07 Feb 2014 12:46, edited 2 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)

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

Re: PIC related website

#653 Post by Dany » 21 Nov 2012 12:06

Any progress?
Dany wrote:
Toley wrote:
You should replace the __Lib_Fat32_driver.mpas (as I did) by the adapted one in the dspic packages library, or (perhaps better) place the adapted driver locally in your project and enter it in the project manager.
Yes this is what I did with your latest (today) update in Libstock. I replaced the one already include in the FAT32 package inside the dsPIC\Packages\FAT32 Library\Uses
Odd.

If compiling stops with errors, then it is presumably in the "Fat32_Driver" unit. The top of that file shown then in the IDE must look like:

Code: Select all

unit __Lib_FAT32_Driver;

// USB Memory stick version (+ existing MMC version), 2012-09-30

{-$DEFINE MMC}        // choose one or the other  // <--------------------------------
{$DEFINE USB_STICK}   // here                     // <--------------------------------

uses __Lib_FAT32_Types, __Lib_FAT32_Defs, 
{$IFDEF USB_STICK}
  USB_HOST_MSD_Library
{$ENDIF}
;
Could yo verify that please?

And: at which line does the compilation stops? Or is it at linking time that the error occurs?

If above is Ok, then I can not guess any more what the problem could be... :oops:

p.s. I see that mE made the "Fat32_driver" unit dependant of the "mmc" library in the package manager. So, automatically the "mmc" and "spi" libraries are checked to "on" in the library manager after checking the Fat32_library libs.
Here this gives no problem at all.
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)

Toley
Posts: 922
Joined: 03 Sep 2008 16:17

Re: PIC related website

#654 Post by Toley » 21 Nov 2012 12:38

Hello Dany, the project still not compile. I did not put anymore time into it.
Serge T.
Learning is an endeless process but it must start somewhere!

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

Re: PIC related website

#655 Post by Dany » 21 Nov 2012 20:29

Toley wrote:Hello Dany, the project still not compile. I did not put anymore time into it.
Sorry to hear that... :?
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: PIC related website

#656 Post by Dany » 22 Nov 2012 13:37

Hi,

The "Button_Utils" library (http://www.libstock.com/projects/view/39/utilities) has been extended with "Timed" buttons:
A "timed" button has 2 different functions: one function when the key is pressed for a short time,
another function when the key is pressed for a long time.
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)

Tomy
Posts: 47
Joined: 25 Jun 2007 16:50

Re: PIC related website

#657 Post by Tomy » 24 Jan 2013 14:36

Hi Dany,

I may find a typing error from your site.
Here : http://www.rosseeld.be/DRO/PIC/NextSerialPortNo.htm

It say "To view or change the settings open the registry (with dos command "RedEdit") and navigate to the following area of the registry:"
Do you mean "RegEdit" ?

About USB-HID DLL, can you give me Joop Beunders website ? I can't find it anywhere.

About your usb library. Each time when you do USB_CDC_Read/Write, you need to copy to/from internal USB buffer. Can we just use a pointer to point to USB buffer and directly use it ? (increase speed a bit)

One more question, do you have MikroPascal Pro USB HID bootloader with Delphi source ?

Thanks.

Best Regards,
Tomy

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

Re: PIC related website

#658 Post by Dany » 24 Jan 2013 19:00

Tomy wrote:Hi Dany,

I may find a typing error from your site.
Here : http://www.rosseeld.be/DRO/PIC/NextSerialPortNo.htm

It say "To view or change the settings open the registry (with dos command "RedEdit") and navigate to the following area of the registry:"
Do you mean "RegEdit" ?
Indeed, I will correct this as soon as possible. :oops:
Tomy wrote:About USB-HID DLL, can you give me Joop Beunders website ? I can't find it anywhere.
I will ask him first...
Tomy wrote:About your usb library. Each time when you do USB_CDC_Read/Write, you need to copy to/from internal USB buffer. Can we just use a pointer to point to USB buffer and directly use it ? (increase speed a bit)
The current version of USB-CDC has double buffering, the user buffer and the actual USB packet buffer are separate ones. The possibility of using the USB packet buffers directly does not exist. :?
Tomy wrote:One more question, do you have MikroPascal Pro USB HID bootloader with Delphi source ?
No I havent. Perhaps you can ask mikroElektronika to provide it to you.
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: PIC related website

#659 Post by Dany » 26 Jan 2013 20:24

Dany wrote:
Tomy wrote:About USB-HID DLL, can you give me Joop Beunders website ? I can't find it anywhere.
I will ask him first...
Tomy, the e-mail address of Joop has been sent to you by private message.
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: PIC related website

#660 Post by Dany » 04 Feb 2013 19:08

Dany wrote:2012-08-25:
Added an article to the Website about the mP for PIC Make (Build) process, see http://www.rosseeld.be/DRO/PIC/Make_Process.pdf.

It explains (I hope) the relations that play during the development and make process in mP for PIC. Some of the descriptions will probably also fit other environments than mP for PIC.

Please do comment if the document is unclear, incomplete, inaccurate or wrong. :oops:

p.s. People of mE: it would be very nice if you could let your light shine on this and give feedback... Thanks! :D :D
Hi,
There is a new version of this document: The section "libraries" (section 15) has been extended with the following text:
Libraries distributed without the source (actually without source in the language of the
compiler used) can not use the following routines:
- “Delay_ms”
- “Delay_us”

The reason is that those routines are “inline” routines: their contents is defined at compile time, and
will not be adapted to another clock speed than the one used at compile time.
This means that, when trying to use a library at another clock speed than the compile time one, the
compiler will need the source file of the library to re-compile it. If the source file is not present an
error similar to “File 'C:\Users\Public\Documents\Mikroelektronika\mikroBasic PRO for
PIC\Packages\USB_OA\Uses\USB_HID_Library.mbas' not found” will occur.

Solution:
Do not: use the routines mentioned above if you intend to distribute libraries with only the .mcl file
available.
Instead: use only the delay routines available in the unit “__Lib_Delays.mpas” (installation
folder/uses/). This unit is always recompiled in a project and the calls there to both forbidden
routines are always adapted to the clock speed of the project at hand.

You can of course use both routines without any problem in your project files.
Last edited by Dany on 07 Feb 2014 12:47, 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)

Post Reply

Return to “mikroPascal PRO for PIC General”