Interrupt timer Very useful for checking sensor readings line followerExample: Checking the line sensor readings line follower walk along the white line, check the number of intersections passed (sensor opposing line).
Figure 1 shows the bits in the TCCR2A register.
![]() |
Figure 1. Register TCCR2A |
Figure 2 shows the bits in the TCCR2B register
![]() |
Figure 2. Register TCCR2B |
This project does not adjust the TCCR2A register because it does not enable PWM on this register, so all the WGMnx and COMnx bits in the TCCR2A register are ignored.
Use the pad to register TCCR2B with the pen on the CSnx bit pad based on tab 1 to determine the frequency timer. Table 1 Shows the setting options bit by bit to set select hour.

Setting the TCCR2B register on CS20 and CS21 bits by setting each bit with a value of 1 to get the frequency calculation klk/32. And this one has a different number of clk/8 types at once, clk/1, and the blog post only has one clk/32 pendulum, so there is no other way to use it and use sensors to guard against it. that is safe.
From the explanation above, psetup list timer TCCR2A and PWM timer can be reinstalled:
TCCR2B = 0b00000011;
Or it can be written as
TCCR2B = 0x03
After configuring the register timer TCCR2B can be used to register TIMSK2 (Register Interrupt Mask Timer/Counter2). Figure 3 shows the bits in the TIMSK2 register.
![]() |
Figure 3. TIMSK2 list |
To run bother that has been set is by writing the command 'sei()'
Activate interrupt timer 2
Starting with the help of writing a program to activate bother timer 2:
TCCR2B =0b00000011; //Activates the timer with frequency clkio/32.
TIMSK2 = 0b00000001; //Activate mode Timer/Counter overflow interrupt2.
sei(); //Executes all bother you have been activated.
Write the sub program on vector interrupt
After configuring interrupt timer 2 mode. mode overflowingThe thing that needs to be done then is to write down the sub programs that are frequently called on vector interrupt. This program contains all the sub-programs that appear in the program vector interrupt Is a program for checking line sensors.
Writing programs on vector interrupt timer 2 This can be done with the help of someone else at home:
ISR(TIMER_OVF_vek) // Vector interrupt timer 2 mode. mode overflowing
{
dataSensor = readSensor();
temperature = digitalRead(sensor4);
if (temperature == 1)
{
if (flipflop == 0)
{
flipflop = 1 ;
counter++;
}
}
if(temperature == 0)
filpflop = 0
}
The aim of writing the program above is to make the sensor reading program network counter executed on interrupt timer so that sensor readings will always be carried out continuously when an interruption occurs timer And without having to wait for the main program to finish.
- Grid Line Follower Working Concept
- How Arduino Uno's PWM works for regulating dc motor speed
- Interrupt timer For line sensor reading
- Line Sensor Reading Program Code
- Mechanics and movement Grid Line Follower
- Complete Code Grid Line Follower
- PCB and Grid Line Follower Circuit