test interruptIn feature with 555 timer
Dependencies: ClockControl PowerControl mbed
Fork of Frequency_counter by
Test interruptIn function with using LMC555 timer IC
LPC 1768 自身が持つタイマー割り込み機能を使わずに、 あえて外部のタイマー IC 555 からの信号で周期的に割り込みするテスト。
下記の回路例では、555 の output 端子が 約 10 秒周期のうち、0.3 秒間 Low になるはず。 ただし、コンデンサーおよび抵抗の誤差の影響があり、実測値は約7秒周期
C を 47μ から 330 μ に変えると約1分前後で周期的に割り込みがかかります。
なるべく配線が交差しないように部品配置してみた例
Diff: main.cpp
- Revision:
- 2:c4d4f0f9d77c
- Parent:
- 1:e2034bcdb101
- Child:
- 3:bf0a5effbed2
--- a/main.cpp Sat Jun 01 05:44:10 2013 +0000 +++ b/main.cpp Sat Jun 01 07:49:57 2013 +0000 @@ -23,7 +23,6 @@ t1.reset();// Reset timer and wait for next interrupt } else { //No use interrupt - in.mode(PullDown); vcc555 = led = 0; t1.stop(); } @@ -32,8 +31,8 @@ int main() { vcc555 = led = 0; + in.mode(PullUp); in.rise(&flip);// Set up the interrupt for rising edge - in.mode(PullDown); pc.printf("\rStarting measure\n"); @@ -42,7 +41,6 @@ t1.start(); in_count = in_limit; vcc555 = led = 1; - in.mode(PullUp); wait_ms(200); if (t_period > 0){