TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (91 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139271 times)
  2. FAT32 Library (71756 times)
  3. Network Ethernet Library (57128 times)
  4. USB Device Library (47433 times)
  5. Network WiFi Library (43098 times)
  6. FT800 Library (42409 times)
  7. GSM click (29835 times)
  8. mikroSDK (28104 times)
  9. PID Library (26886 times)
  10. microSD click (26200 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Library

PIC24F Timer modules with callback support

Rating:

0

Author: Anton Rieckert

Last Updated: 2012-04-13

Package Version: 1.0.0.0

Category: Timers (Real time clock)

Downloaded: 844 times

Followed by: 1 user

License: MIT license  

This library makes it easier to work with the build in timer modules of the PIC24F range. There are 2 units you can include in your source code. The initialisation function takes 2 parameters, the interval in milliseconds and the callback function that should be executed.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "PIC24F Timer modules with callback support" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "PIC24F Timer modules with callback support" changes.

Do you want to report abuse regarding "PIC24F Timer modules with callback support".

  • Information
  • Comments (0)

Library Blog

PIC24F Timer library with callback support

Example

program TimerExample;

// Include the timer module libraries that you want to use
uses 
  libTimer1,
  libTimer2;

//==============================================================================
procedure Timer1Callback;
begin
  // This procedure will be called every 1000 ms
  LatB := PortB xor 0xFF00;
end;

//==============================================================================
procedure Timer2Callback;
begin
  // This procedure will be called every 500 ms
  LatB := PortB xor 0x00FF;
end;

//==============================================================================
begin
  // Init the CPU and pint
  TrisB := 0x0000;
  LatB  := 0x0000;

  // Make all pins digital
  AD1PCFG := 0xFFFF;

  // Timerx_Init(msInterval : word; aCallback : ^TTimerCallback)
  // The Timerx_Init procedure takes 2 parameters
  // msInterval - Interval in ms the timer should execute a procedure
  // aCallback - Pointer to the procedure that should execute
  
  // Timer 1 will execute Timer1Callback every 100ms
  Timer1_Init(100, @Timer1Callback);

  // Timer 2 will execute Timer2Callback every 250ms
  Timer2_Init(250, @Timer2Callback);
  
  // Start the timers
  Timer1_Enable;
  Timer2_Enable;
  
  // Wait in an endless loop. The callback procedures will be called on the
  // timer interrupts
  while true do;
end.

ALSO FROM THIS AUTHOR

DateTime utilities compatible with Delphi and Lazarus

0

This unit provides you with the functionality to work with date time variables the same way that Delphi and Lazarus handles them. The unit supports - Leap year, - Encode date-time, - Decode date-time, - Increment and decrement functions, - Period functions such as minutes between two dates

[Learn More]

PIC24F ADC library with callback

0

Analog to Digital Library for the PIC24 and dsPIC range. Library supports multiple channels and has a callback function that is executed as soon as all the channels are read. The sampling frequency can also be specified in Hz

[Learn More]

OneWire Communication Library with Search functionality

0

This is a library written for the mikroPascal compilers to interface to these devices on a single bus. The library also includes functions that allows the master device to discover the number of slave devices on the bus and read there serial numbers.

[Learn More]