Innaz Review, Samsung Galaxy, price and specifications, Flash Android, Games For Your Apple, Jailbreak Tool For iOS, IMEI Unlock Method

Minggu, 21 Oktober 2012

How to Set Up a Timer in PIC16F877A

How to Set Up a Timer in PIC16F877A - In the past, when I started to start blogging, many thoughts disturbed me. I want to have a blog with a nice and interesting look. I am constantly looking for basic tutorials from some web and blogs on the internet. And thankfully, one by one I started to do it, and of course have to go through some confusion process first, but the most important of a blog that is content, yes on the blog Innaz Review we will discuss a lot of information about gadgets that are very in need by you, now we will discuss first about How to Set Up a Timer in PIC16F877A please refer to the information we will convey until completion:

Articles : How to Set Up a Timer in PIC16F877A
full Link : How to Set Up a Timer in PIC16F877A

You can also see our article on:


    How to Set Up a Timer in PIC16F877A



    We have Three Timers in PIC16F877A , and here we have a look to how to setup the TIMER0 in PIC16F877A using HiTech C programm 




    • To set up the timer, one must first disable interrupts so that an interrupt doesn’t occur when the timer expires.
    • Then, enable the timer and assign the prescaler to the timer.
    • Establish the prescaler value, and finally, load the timer register.
     Whenever the timer expires, the T0IF bit in the INTCON register will be set.
    • We must clear this bit, reload the timer register, and then execute the code that is to be done at this time.

    In code, the setup portion might look something like:
    ########################## IN ASSEMBLY PROGRAM ###########################
    banksel INTCON
    bcf INTCON,T0IE ; Mask timer interrupt
    banksel OPTION_REG
    bcf OPTION_REG,T0CS ; Enable timer
    bcf OPTION_REG,PSA ; Prescaler to timer
    bcf OPTION_REG,PS2 ; \
    bsf OPTION_REG,PS1 ; >- 1:16 prescale
    bsf OPTION_REG,PS0 ; /
    movlw D’100’ ; Timer will count
    movwf TMR0 ; 156 (256-100) counts

    ######################## IN HITECH C PROGRAM #######################################
    OPTION_REG= 0x0F;
      TMR0=0x0F;
      while(TMR0IF=0);
      TMR0IF=0;
    ##################################################

    • Clearly, the individual bits in the option register could all be set with a single store.
    • If we didn’t care about the RB0 interrupt, the weak pullups, or the transition of RA4, then instead of five bit manipulations we could have said:
    • movlw B’10000011’ ; Set up prescaler and
    • movwf OPTION_REG ; timer

    The execution loop might look something like:



    main:
        btfss INTCON,T0IF ; Did timer overflow?
        goto main ; No, hang around some more 
        movlw D’100’ ; Timer will count
        movwf TMR0 ; 156 (256-100) counts
        bcf INTCON,T0IF ; reset overflow flag
        call DoCode ; Execute main code
        goto main ; Go back and wait





    so much information How to Set Up a Timer in PIC16F877A

    hopefully How to Set Up a Timer in PIC16F877A information can provide benefits for you in determining the gadgets that fit your needs in daily life.

    you just read How to Set Up a Timer in PIC16F877A if you feel this information is useful and want to bookmark or share it please use link https://innaz2.blogspot.com/2012/10/how-to-set-up-timer-in-pic16f877a.html if you want more information please search on other pages this blog.

    Tag :
    Share on Facebook
    Share on Twitter
    Share on Google+
    Tags :

    Related : How to Set Up a Timer in PIC16F877A

      0 komentar:

      Posting Komentar