test interruptIn feature with 555 timer

Dependencies:   ClockControl PowerControl mbed

Fork of Frequency_counter by Satoru Yoshida

Test interruptIn function with using LMC555 timer IC

LPC 1768 自身が持つタイマー割り込み機能を使わずに、 あえて外部のタイマー IC 555 からの信号で周期的に割り込みするテスト。

下記の回路例では、555 の output 端子が 約 10 秒周期のうち、0.3 秒間 Low になるはず。 ただし、コンデンサーおよび抵抗の誤差の影響があり、実測値は約7秒周期

C を 47μ から 330 μ に変えると約1分前後で周期的に割り込みがかかります。

/media/uploads/strysd/int555_10s.png

なるべく配線が交差しないように部品配置してみた例

/media/uploads/strysd/555test.jpg

Committer:
strysd
Date:
Sun May 11 07:29:02 2014 +0000
Revision:
8:cb966096a916
Parent:
7:42e7f18361c8
test interrupt by 555

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Neel 0:c5bcf643a8b1 1 #include "mbed.h"
strysd 8:cb966096a916 2 #include "PowerControl/EthernetPowerControl.h"
strysd 8:cb966096a916 3 #include "ClockControl/ClockControl.h"
strysd 1:e2034bcdb101 4
strysd 8:cb966096a916 5 InterruptIn in(p8); //Connect from output of 555
strysd 7:42e7f18361c8 6 DigitalOut led1(LED1);//running 555
Neel 0:c5bcf643a8b1 7
strysd 8:cb966096a916 8 /* stop USB Interface */
strysd 8:cb966096a916 9 #define USR_POWERDOWN (0x104)
strysd 8:cb966096a916 10 int semihost_powerdown() {
strysd 8:cb966096a916 11 uint32_t arg;
strysd 8:cb966096a916 12 return __semihost(USR_POWERDOWN, &arg);
strysd 8:cb966096a916 13 }
Neel 0:c5bcf643a8b1 14
Neel 0:c5bcf643a8b1 15 void flip(void)
Neel 0:c5bcf643a8b1 16 {
strysd 8:cb966096a916 17 led1 = !led1;
Neel 0:c5bcf643a8b1 18 }
Neel 0:c5bcf643a8b1 19
Neel 0:c5bcf643a8b1 20 int main() {
strysd 8:cb966096a916 21 led1 = 0;
strysd 1:e2034bcdb101 22
strysd 8:cb966096a916 23 setSystemFrequency(0x3, 0x1, 6, 1);//clock down from 96MHz to 48MHz
strysd 8:cb966096a916 24
strysd 8:cb966096a916 25 semihost_powerdown();//Stop also USB Interface
strysd 8:cb966096a916 26 PHY_PowerDown();//net
strysd 5:9be3080ca8ba 27
strysd 8:cb966096a916 28 // Set up the interrupt
strysd 8:cb966096a916 29 in.mode(PullNone);
strysd 8:cb966096a916 30 in.rise(&flip);
strysd 8:cb966096a916 31
strysd 8:cb966096a916 32 while(1){
strysd 8:cb966096a916 33 wait(1);
Neel 0:c5bcf643a8b1 34 }
strysd 8:cb966096a916 35
Neel 0:c5bcf643a8b1 36 }