timer in pic18f

Home Forums Microcontrollers PIC Microcontroller timer in pic18f

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8867
    PN
    Participant

    Hi, can you guide me on use of timers of pic? actually what i have to do is, for 8sec time, i have to average values from a sensor. how do i increment count every sec? will the following method work instead of timers?

    for(count=0;count<= 8;count++)
    {
       do(something);
       delay_ms(1000);
    }
    
    #9359
    Ligo George
    Keymaster

    You may solve it by incrementing a variable as above…. but the best solution is to use PIC’s internal timer module..
    eg :

    //Start Timer
    for(a=read_timer;a< a_value;)
    {
        //Do Something
    }
    //Stop Timer
    

    You can use Timer0 module… Read the Timer0 section in the datasheet.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
>