Skip to content

Commit c07a147

Browse files
animeshsrivastava24per1234
authored andcommitted
Typos fixed in attachInterrupt.adoc (#633)
Line 44: Unnecessary comma in a compound predicate. Line 46: insure to ensure (Requires suggestion). Addition of comma. Line 50: Addition of comma. Line 52: Unnecessary comma in a compound predicate. Line 73: Addition of the Line 77: the singular verb "allows" doesn't agree with the plural subject "boards" Line 121: Unnecessary comma in a compound predicate. on to for is run to runs
1 parent 4c810f7 commit c07a147

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Language/Functions/External Interrupts/attachInterrupt.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ Inside the attached function, `delay()` won't work and the value returned by `mi
4141

4242
[float]
4343
== Using Interrupts
44-
Interrupts are useful for making things happen automatically in microcontroller programs, and can help solve timing problems. Good tasks for using an interrupt may include reading a rotary encoder, or monitoring user input.
44+
Interrupts are useful for making things happen automatically in microcontroller programs and can help solve timing problems. Good tasks for using an interrupt may include reading a rotary encoder, or monitoring user input.
4545

46-
If you wanted to insure that a program always caught the pulses from a rotary encoder, so that it never misses a pulse, it would make it very tricky to write a program to do anything else, because the program would need to constantly poll the sensor lines for the encoder, in order to catch pulses when they occurred. Other sensors have a similar interface dynamic too, such as trying to read a sound sensor that is trying to catch a click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop. In all of these situations, using an interrupt can free the microcontroller to get some other work done while not missing the input.
46+
If you wanted to ensure that a program always caught the pulses from a rotary encoder, so that it never misses a pulse, it would make it very tricky to write a program to do anything else, because the program would need to constantly poll the sensor lines for the encoder, in order to catch pulses when they occurred. Other sensors have a similar interface dynamic too, such as trying to read a sound sensor that is trying to catch a click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop. In all of these situations, using an interrupt can free the microcontroller to get some other work done while not missing the input.
4747

4848
[float]
4949
== About Interrupt Service Routines
5050
ISRs are special kinds of functions that have some unique limitations most other functions do not have. An ISR cannot have any parameters, and they shouldn't return anything.
5151

52-
Generally, an ISR should be as short and fast as possible. If your sketch uses multiple ISRs, only one can run at a time, other interrupts will be executed after the current one finishes in an order that depends on the priority they have. `millis()` relies on interrupts to count, so it will never increment inside an ISR. Since `delay()` requires interrupts to work, it will not work if called inside an ISR. `micros()` works initially, but will start behaving erratically after 1-2 ms. `delayMicroseconds()` does not use any counter, so it will work as normal.
52+
Generally, an ISR should be as short and fast as possible. If your sketch uses multiple ISRs, only one can run at a time, other interrupts will be executed after the current one finishes in an order that depends on the priority they have. `millis()` relies on interrupts to count, so it will never increment inside an ISR. Since `delay()` requires interrupts to work, it will not work if called inside an ISR. `micros()` works initially but will start behaving erratically after 1-2 ms. `delayMicroseconds()` does not use any counter, so it will work as normal.
5353

5454
Typically global variables are used to pass data between an ISR and the main program. To make sure variables shared between an ISR and the main program are updated correctly, declare them as `volatile`.
5555

@@ -74,7 +74,7 @@ For more information on interrupts, see http://gammon.com.au/interrupts[Nick Gam
7474
* *RISING* to trigger when the pin goes from low to high, +
7575
* *FALLING* for when the pin goes from high to low. +
7676

77-
The Due, Zero and MKR1000 boards allows also: +
77+
The Due, Zero and MKR1000 boards allow also: +
7878

7979
* *HIGH* to trigger the interrupt whenever the pin is high.
8080

@@ -118,7 +118,7 @@ void blink() {
118118

119119
[float]
120120
=== Interrupt Numbers
121-
Normally you should use `digitalPinToInterrupt(pin)`, rather than place an interrupt number directly into your sketch. The specific pins with interrupts, and their mapping to interrupt number varies on each type of board. Direct use of interrupt numbers may seem simple, but it can cause compatibility trouble when your sketch is run on a different board.
121+
Normally you should use `digitalPinToInterrupt(pin)`, rather than place an interrupt number directly into your sketch. The specific pins with interrupts and their mapping to interrupt number varies for each type of board. Direct use of interrupt numbers may seem simple, but it can cause compatibility trouble when your sketch runs on a different board.
122122

123123
However, older sketches often have direct interrupt numbers. Often number 0 (for digital pin 2) or number 1 (for digital pin 3) were used. The table below shows the available interrupt pins on various boards.
124124

0 commit comments

Comments
 (0)