Timer Application


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161

    Default Timer Application

    Hello Once again,

    I have a small application involving a Timer operation in which , on a press of a button , I have three LEDs that glow, The first LED switches off after 7 seconds, second LED switches off after 10 seconds and finally the third Switches OFF after 12 Seconds. The Duration of LEDs would change depending on different application.

    I am interested in doing this with the On Board Timer and PIC Basic Pro Compiler.

    Can anybody help me.

    Thank you.

  2. #2
    electronicsuk's Avatar
    electronicsuk Guest


    Did you find this post helpful? Yes | No

    Default

    You could quite easily use PAUSE and a FOR/NEXT loop, assuming you have other tasks to process as well as working the LED's.

    Matthew

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    This can be accomplished quite easily with the "Elapsed Timer Demo" found at http://www.picbasic.co.uk/forum/show...=&threadid=190

    In fact, you can do a lot of other things with it too. Since this thread is getting so many "Views" I assume that's what most people are really looking for.

    Darrel

  4. #4
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Default

    Thank you Darrel. I shall surely go thru it and get back to you.

  5. #5
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Charudatt,



    Your program can use this example as a base,

    It could look something like the following:

    LED1 var GPIO.0 ; Or whatever pin works on your chip.
    LED2 var GPIO.1
    LED3 var GPIO.2

    FirstLed var byte
    SecondLed var byte
    ThirdLed var byte
    counter var byte


    Loop:

    ;Here your source gives you the values of the LED's length of time to stay on....


    FirstLed=7 ;these values you get from your source
    SecondLed=10
    ThirdLed=12

    ; Lets turn them all on!!!
    High LED1
    High LED2
    High LED3

    counter=FirstLed*1000
    Pause(counter);
    Low LED1;

    counter=(SecondLed-FirstLed*1000)
    Pause(counter);
    Low LED2;

    counter=ThirdLed-SecondLed*1000);
    Pause(counter);
    Low LED3;

    Goto Loop
    Last edited by Dwayne; - 16th February 2004 at 06:20.

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts