PIC16F877A routine -- timer interrupt

Publisher:sumigLatest update time:2015-11-17 Source: eefocusKeywords:PIC16F877A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
#include     //Call header file

//#include

__CONFIG(0x3F32); //Chip configuration word

 

 

#define    uchar  unsigned    char

#define uint   unsigned int

 

void initPORTA(void);

void initTMR2(void);

void interrupt TMR2INT(void);

uint TMR2_COUTER;

uint couter;

void main (void)

{

     TRISA=0X00;

    PORTA=0XFF;      //Timer interrupt controls LED flashing

 

    OPTION=0x07;     //TMR0----256 division

    INTCON=0XA0;     //Open the general interrupt and TMR0 count overflow interrupt

    TMR0=0xc3;       //Timer initial value

     while(1)

     {

      ;

     }

}

 

void interrupt TMR0INT()

{

    T0IF=0;

    couter++;

    if(couter==10)

    {

         couter=0;

        DOOR=~DOOR;

    }

     TMR0=0xc3;

 

}

 

Keywords:PIC16F877A Reference address:PIC16F877A routine -- timer interrupt

Previous article:PIC16F877A Example Program --- LCD1602
Next article:PIC16F877A routine --- DS1302 program

Recommended ReadingLatest update time:2024-11-16 16:22

PIC16 MCU LCD1602 Driver PIC16F877A PIC16F887
/* LCD display related */ #define DATA 1 /* LCD writes data to 1 */ #define COM 0 /* LCD write command is 0 */ #define LINE1 0b10000000 #define LINE2 0b11000000 #define LCD_E RD6 #define LCD_RW RD5 #define LCD_RS RD4 void LCD_WRITE_4( unsigned char R1, unsigned char FLAG ); void LCD_WRITE( unsigned char R1
[Microcontroller]
PIC16 MCU LCD1602 Driver PIC16F877A PIC16F887
PIC16F877A serial port transmission
PIC16F877A serial port sending and querying methods. It took me a day to find out this. It turned out to be a problem with the serial port chip voltage. The summary is as follows: 1. Pay attention to the power supply voltage of the 232 serial port chip, there are 5V and 3.3V 2. Pay attention to the TXD and RXD wirin
[Microcontroller]
PIC16F877A serial port transmission
C51中断(void timer1(void) interrupt 3 using 3)
interrupt indicates the interrupt priority, and using indicates the working register group used. interrupt x using y        The xx value after interrupt is the interrupt number, that is, which interrupt port this function corresponds to. Generally in 51,        0 is external interrupt 0          1 is timer 0        2
[Microcontroller]
Detailed explanation of port B of pic16f877a
The following is an excerpt from the introduction of Port B:   When we write programs, we must pay attention to the judgment of interrupts, and the difference between reading and writing.
[Microcontroller]
Detailed explanation of port B of pic16f877a
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号