+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Junior Member level 3
    Points: 1,639, Level: 9
    Achievements:
    7 years registered

    Join Date
    Jan 2010
    Location
    TEHRAN
    Posts
    29
    Helped
    3 / 3
    Points
    1,639
    Level
    9

    PIC18F452 Timers/Counters Interrupts,...

    Hello everybody.I want to write a program using PIC18F452&XTAL=20MHZ in C or mikroC to do the followings;

    1.Simultaneously turn a timer on[timer0 or...] to count for 1 sec. and
    also count the number of High[transition from H to L] state of the
    input signal.

    2.Turn a timer on[timer0 or...] for 1 sec. and as soon as a input signal injected or entered to a PIC pin the timer[timer0 or...]immediately turned off and calculate the time of passed by that timer.

    Would you please help and give me some example codes to write those programs?

    Thanks,

    •   Alt23rd April 2011, 20:48

      advertising

        
       

  2. #2
    Administrator
    Points: 69,035, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,831
    Helped
    2351 / 2351
    Points
    69,035
    Level
    64
    Blog Entries
    4

    Re: PIC18F452 Timers/Counters Interrupts,...

    Here's examples of interrupt and timer use:

    PIC Interrupts - Part 1

    PIC16F877 Timer Modules tutorials

    Introduction to PIC18′s Timers

    Interrupts - Writing The Code

    The above examples are have similarities to both your scenarios.

    Scenario 1 uses an external interrupt edge transition or external clock input and timer overflow interrupt.

    Scenario 2 uses an external interrupt edge transition and timer overflow interrupt.

    Hope the info helps in your endeavors.



--[[ ]]--