Showing posts with label Creat easily Multiple non-blocking delays. Show all posts
Showing posts with label Creat easily Multiple non-blocking delays. Show all posts

Creat easily Multiple non-blocking delays with 1 timer

0 comments

This example shows you how to create multiple non-blocking delays with only one timer, using :
  • timer 1
  • interrupts
  • arrays of pointers to functions
  • structures
It is made for a P18F452 but it could be used with others pics with just minor adjustments.

/*
 * this source code shows how to use pic timers, interrupts, 
and arrays of pointers to functions
 * and how to make non-blocking multiples delays, using a single timer
 *
 * Bruno Gavand, march 2006
 * www.micro-examples.com
 *
 * P18F452 @8Mhz, HS clock, EASYPIC2 / EASYPIC3
 * pull-down on PORTB
 * pull-up on keyboard
 * enable PORTB, PORTC and PORTD LEDs
 *
 * pressing RB0 key will toggle PORTC after a 2s non-blocking delay
 * pressing RB1 key will toggle PORTD after a 3s non-blocking delay
 *
 * used ROM : 1676 bytes
 */

More click on title..

 

Free Download Engineering Books - IEEE Books | Copyright 2009-2013 All right reserved | Design by BMW Automobiles | Created by Umair Sheikh