interrupt [TIM0_OVF] void timer0(void) //Timer interrupt service function
{
TCNT0=0xff; // Reset the initial value of TCNT0
PORTD.4 = ~PORTD.4; // PD4 reverse output
}
void main(void)
{
DDRD=0XF0; //PD port direction register, high is output, low is input
PORTD=0XFF; //PD port data register writes all 1
TIMSK=0X01; //Open timer, counter 0
TCCR0=0X07; //Timer clock control register
TCNT0=0XFF; //Timing count register
OCR0=0X00; //Output compare register
#asm("sei"); //Open all interrupts
while(1);
}
Previous article:Basic application of USART serial communication of AVR microcontroller
Next article:How to set the operating frequency of the AVR Mega16 on-chip RC oscillator
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- Mini car SMARS-mini-XL
- Is it necessary for software developers to take a software exam?
- AD19 Software
- When the switching power supply current measuring resistor is placed in these 6 positions!
- How to build an excellent Linux development environment based on AM335X (Part 2)
- [Repost] What are the grounding techniques for electronic design?
- TI microcontroller I8669/I44445 (MCU) MSP430 combines low power consumption with high performance
- The role of magnetic beads and their working principle
- I'm new to PCB, need help, thanks
- Is this true? Most people who buy Apple phones are "invisible poor people"