PIC related Website

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

PIC related Website

#1 Post by Dany » 29 May 2011 13:44

Hi, from now on also P24 items will be published on the PIC related Website (http://www.rosseeld.be/DRO/PIC/index.htm).

The first P24 item added is a PPS (Peripheral Pin Select) library (see http://www.rosseeld.be/DRO/PIC/libraries.htm#pps):
(simple) Library for selecting peripheral programmable pins. Only for P24.
Permits also to work with the "config2" "IOL1Way" set to "1" (IOlock protection enabled): the unlocking/locking activities are not done inside the pin setting routines here, they have to be done separately.
This means all peripheral in/out settings can be done after a reset and after that the final "IOlock" can be done.

If you use this lib, make sure it is always re-compiled for the project where it is used in.
The main reason to make this small lib can be found here: http://www.mikroe.com/forum/viewtopic.php?f=106&t=32803. The "IOL1Way" bit in config 2 word could not be reset with the P24JF64GA002 PIC.
The additional reason was "exercise": it was the first time I came in contact with PPS, and I wanted to understand the mechanism.

Have fun! :D
Last edited by Dany on 30 Nov 2013 17:12, edited 3 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

#2 Post by Dany » 07 Jun 2011 19:07

Hi, the "FunctionCalls" tool has been adapted to show the list of the interrupt routines in a separate window (since there can be a lot of interrupt routines). Please find the tool at: http://www.rosseeld.be/DRO/PIC/tools.htm#FunctionCalls.

The tool has only been tested on P24.

Have fun! :D :D
Last edited by Dany on 30 Nov 2013 17:13, 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: PIC related Website

#3 Post by Dany » 09 Jun 2011 19:07

Hi, in analogy with the PIC related items on the website, I made also a "Pitfalls" file for PIC24, mP for dsPic30/33/Pic24 and the Lv24-33 programmer,
see http://www.rosseeld.be/DRO/PIC/PIC24Pitfalls.htm.

For now it reflects the issues I heavily struggled with during my start period with PIC24 MCU's (only one type used till now however: P24FJ64GA002).

Enjoy. :D :D
Last edited by Dany on 23 Jun 2011 19:22, 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: PIC related Website

#4 Post by Dany » 23 Jun 2011 19:20

Hi all,

* Following libraries on the website are P24 compliant now:
Fat32, Asserts, Cos, Timebase, Debug, StrngUtils, SDMMC_Utils, BitUtils and PascalFunctions.

* Following P24 specific libraries are available: PPS and UsartReceiver_P24.


Please find them on http://www.rosseeld.be/DRO/PIC/libraries.htm.

Have fun! :D :D
Last edited by Dany on 30 Nov 2013 17:14, 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: PIC related Website

#5 Post by Dany » 03 Jul 2011 13:23

Hi all,

There is a new PIC24 library: RTCC_P24.mpas. It handles the internal RTCC (Real time clock and calender).

For the unit's code and a usage example, see http://www.rosseeld.be/DRO/PIC/libraries.htm#RTCC.

Important: at this moment (using mP v5.00) SSA optimisation should be set to OFF.

The library's interface:

Code: Select all

// -------------------  Interface ------------------------

type TTimeDate =
     record
       Hours, Mins, Secs, WeekDay, Day, Month: byte;
       Year: word;
     end;
     
     TAlarm =
     record
       Hours, Mins, Secs, WeekDay, Day, Month: byte;
     end;
     
// ----- General ----

procedure RTCC_Secondary_Oscillator_On(On_: boolean);
// Starts the secondary (32.758 Khz) oscillator. X-tal and C's needed

procedure RTCC_Set_Write_Enable(On_: boolean);
// Makes the RTCC writable (On=true) or ReadOnly (On = false), needed for starting up

procedure RTCC_Init(Enable_SOSC: boolean; Adjustment: Short);
// initialization of the RTCC with optional switch of of secondary oscillator,
// calibration according the Adjustment value (-128..+127).


// ----- Clock ----

procedure RTCC_Set(var TimeDate: TTimeDate);
// Sets the clock values in the RTCC. All values should be delivered in BCD.

procedure RTCC_Get(var TimeDate: TTimeDate);
// Gets the clock values out of the RTCC. All values returned are in BCD.

procedure RTCC_Set_Clock_On_Off(On_: boolean);
// Enables or disables the clock according "On_" (true = on, false = off)

function RTCC_Clock_On: boolean;
// returns true if the RTCC clock is running, else false

procedure RTCC_Output(Val: byte);
// sets the RTCC output pin according Val

procedure RTCC_TimeStr(var TimeDate: TTimeDate; var Ts: string[8]);
// converts TimeDate into a displayable "time" string: hh:mm:ss (24 hr mode) in Ts

procedure RTCC_DateStr(var TimeDate: TTimeDate; var Ds: string[10]);
// converts TimeDate into a displayable "date" string: dd/mm/yyyy in Ds

procedure RTCC_TimeDateStr(var TimeDate: TTimeDate; var Ts: string[8]; var Ds: string[10]);
// converts TimeDate into a displayable "time" string: hh:mm:ss (24 hr mode) in Ts, and
// a displayable "date" string: dd/mm/yyyy in Ds

function RTCC_TimeChanged(var TimeDate: TTimeDate): boolean;
// returns true if the current time (only secs compared) is different than TimeDate
// also returns the current time in TimeDate

procedure RTCC_Fill_TimeDate(var TimeDate: TTimeDate; Hours, Mins, Secs, WeekDay, Day, Month: byte; Year: word);
// Fills TimeDate with the values Hours, .. Year


// ----- Alarm ----

procedure RTCC_Get_Alarm(var Alarm: TAlarm);
// Gets the alarm time out of the RTCC, all values returned are in BCD

procedure RTCC_Set_Alarm(var Alarm: TAlarm);
// Sets the alarm time in the RTCC. All values should be delivered in BCD.

procedure RTCC_Set_Alarm_Config(Mask: byte; Chime: boolean; Repeat_: byte);
// Sets the alarm configuration (see datasheet for the details)

procedure RTCC_Set_Alarm_On_Off(On_: boolean);
// Enables or disables the alarm according "On_" (true = on, false = off)

function RTCC_Alarm_On: boolean;
// returns true if the RTCC alarm is on, else false


// ------ Constants --------

const // values for RTCC_Output
      _RTCC_OUTPUT_OFF   = 0;
      _RTCC_OUTPUT_1HZ   = 1;
      _RTCC_OUTPUT_ALARM = 2;    // the RTCC output will change state on every alarm
      
      // Alarm masks
      _RTCC_MASK_HALF_SEC  = 0;  // Alarm settings do not matter
      _RTCC_MASK_ONE_SEC   = 1;  //             "
      _RTCC_MASK_TEN_SEC   = 2;  // Every 10 seconds, on the alarm seconds units
      _RTCC_MASK_ONE_MIN   = 3;  // Every minute, on the alarm seconds
      _RTCC_MASK_TEN_MIN   = 4;  // Every 10 minutes, on the alarm minutes units and the alarm seconds
      _RTCC_MASK_ONE_HOUR  = 5;  // Every hour, on the alarm minutes and alarm seconds
      _RTCC_MASK_ONE_DAY   = 6;  // Every day, on the alarm hours, minutes and seconds
      _RTCC_MASK_ONE_WEEK  = 7;  // Every week, on the alarm weekday, hours, minutes and seconds
      _RTCC_MASK_ONE_MONTH = 8;  // Every month, on the alarm day, hours, minutes and seconds
      _RTCC_MASK_ONE_YEAR  = 9;  // Every year, on the alarm month, day, hours, minutes and seconds


implementation
Have fun! :D :D
Last edited by Dany on 30 Nov 2013 17:14, 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: PIC related Website

#6 Post by Dany » 08 Jul 2011 14:47

Hi, the alarm functions are implemented now in the RTCC_P24.mpas unit. For its interface, please see previous post. :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: PIC related Website

#7 Post by Dany » 15 Jul 2011 12:37

Hi, the following routines have been added to the Fat32 library (http://www.rosseeld.be/DRO/PIC/libraries.htm#fat_units):
function mmc_Fat32_TotalSpace: DWord;
// Gives the total space in bytes on the Fat32 formatted card.
// xxx_Fat32_Init has to be called first.

function mmc_Fat32_FreeSpace: DWord;
// Gives the free space in bytes on the Fat32 formatted card.
// xxx_Fat32_Init has to be called first.

function mmc_Fat32_UsedSpace: DWord;
// Gives the used space in bytes on the Fat32 formatted card.
// xxx_Fat32_Init has to be called first.
The PIC24 libs: http://www.rosseeld.be/DRO/PIC/libraries.htm#fat_units

have fun! :D
Last edited by Dany on 30 Nov 2013 17:18, 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)

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

Re: PIC related Website

#8 Post by Dany » 16 Jul 2011 19:14

Ref: above post about the card space functions.

I did add routines to give the result in Kilobytes, MegaBytes (rounded down) and GigaBytes (rounded down) next to the one giving the results in bytes. The latter can only be used for cards with a size <= 4 Gigabytes, a "Dword" has too less bits to be able to hold the #bytes of such card. Thanks Claudio for drawing my attention to this matter.
In such cases one should use one of the other routines. The one returning the result in Kilobytes uses no rounding (is accurate), the ones returning the result in megabytes and gigabytes do (result not accurate).

Have Fun! :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: PIC related Website

#9 Post by Dany » 17 Jul 2011 12:32

Hi, again the Fat32.mpas unit has been updated: a routine returning the "VolumeLabel" has been added.
See http://www.rosseeld.be/DRO/PIC/libraries.htm#fat_units.

Have fun! :D :D
Last edited by Dany on 30 Nov 2013 17:19, 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

#10 Post by Dany » 29 Aug 2011 19:55

Hi,

The PIC24 packages have been added to the website and to LibStock now.

Have fun!
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

#11 Post by Dany » 12 Sep 2011 10:43

Hi,

The PIC 24 related packages have been moved to the more generic library projects in LibStock.

This means that e.g. the Libstock project "FAT_PIC24" is (will be) removed, because the "Fat32_PIC24" package is now in Libstock project "FAT".
Above is valid for all "xxx_PIC24" Libstock projects. The packages in them are moved into the "xxx" Libstock projects.

Sorry for the inconvenience! :oops:

Have fun! :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: PIC related Website

#12 Post by Dany » 06 Oct 2011 18:40

Hi, the PIC24 version of the PID library has been added, see http://www.rosseeld.be/DRO/PIC/libraries.htm#pid_units and http://www.libstock.com/projects/view/161/pid-library.

For the usage examples please see the PIC version.

Have fun! :D
Last edited by Dany on 30 Nov 2013 17:20, 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: PIC related Website

#13 Post by Dany » 18 Oct 2011 11:24

An usage example of the PID library for PIC24 has been published now also.
See http://www.libstock.com/projects/view/161/pid-library.

Have fun! :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: PIC related Website

#14 Post by Dany » 21 Dec 2011 21:29

Hi,

There is a new version of the "FunctionCalls" tool (http://www.rosseeld.be/DRO/PIC/tools.htm#FunctionCalls).
It can show recursive function/procedure calls now (recursive calls caused a stack overflow in the tool previously).

Additionally the tool can handle dsPIC30 and dsPIC33 code now.

Have fun! :D :D
Last edited by Dany on 30 Nov 2013 17:21, 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

#15 Post by Dany » 22 Jan 2012 19:55

Hi, an extra version of the Fat32 library has been added to the website, see http://www.rosseeld.be/DRO/PIC/libraries.htm#fat_units or http://www.libstock.com/projects/view/58/fat.

The new library is named Fat32_2.

Additions are:
- capable of handling more than one open file simultaneously (in possibly different directories).
- a "CopyFile" function has been added.
- for more details see the "history" in the sourcefile

Have fun! :D :D :D
Last edited by Dany on 30 Nov 2013 17:21, 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 dsPIC30/33 and PIC24 General”