Esempio di latenza di un Interrupt
Dependencies: mbed
Revision 0:046cbaef2d68, committed 2016-11-06
- Comitter:
- Mattinico
- Date:
- Sun Nov 06 12:39:18 2016 +0000
- Commit message:
- k;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 06 12:39:18 2016 +0000 @@ -0,0 +1,22 @@ + /* Program Example 2: Tests interrupt latency. External input causes interrupt, which + pulses external LED. +*/ + #include "mbed.h" + InterruptIn squarewave(D2); //Connect input square wave here + DigitalOut out(D3); + DigitalOut out2(D4); + void pulse() //ISR sets external led high for fixed duration + { + out = 1; + wait_us(50); + out = 0; + } + int main() + { + squarewave.rise(&pulse); // attach the address of the pulse function to + // the rising edge + while(1) { // interrupt will occur within this endless loop + Out2=!out2; + wait_ms(25); + } + } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 06 12:39:18 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0 \ No newline at end of file