5MHz OSC. output (using p21) with self frequency counter(using p30).

Dependencies:   mbed

LPC1768 mbed を使った矩形波発生/カウンタプログラムです。

  • PWM ライブラリでは出力の難しい高速の矩形波(1MHz over)を作れます
  • 確認用に内蔵カウンタを利用した周波数カウンタも付属です。こちらも高速なパルスを計測できます。

Rectangular wave generator / counter program using LPC1768 mbed.

  • High-speed rectangular wave (1MHz over) can be made.
  • The frequency counter which uses the 1768 built-in counter, can measure high-rate pulse.
Revision:
4:e7d16ef216d4
Parent:
3:603f4efe3985
--- a/main.cpp	Tue Jun 18 14:15:38 2013 +0000
+++ b/main.cpp	Tue Jun 18 14:18:04 2013 +0000
@@ -2,9 +2,10 @@
 //  CLOCK OUT to PWM1[6] Sample with Freq Counter using Cap2.0 
 //  For LPC1768-mbed
 //
-//  Reference: 1MHz Clock Out Code and Comment - http://mbed.org/forum/mbed/topic/733/
+//  Reference: 5MHz Clock Out Code and Comment - http://mbed.org/forum/mbed/topic/733/
 //
 //  !! To Self Measurement Output Clock, Connect p21 <-> p30 with jumper wire.
+//  2013.6.18 : Wrong comment about MR6 and Duty fix.
 //
 
 #include "mbed.h"
@@ -51,7 +52,8 @@
 }
 
 int main() {        
-    PWM6_SETCLK(96*5) ; // Outout mbed's "PWM6" pin to 96MHZ/19 = 5.052MHz (Approx)
+    PWM6_SETCLK(19) ; // Outout mbed's "PWM6" pin to 96MHZ/19 = 5.052MHz (Approx)
+    // PWM6_SETCLK(96) ; // Outout mbed's "PWM6" pin to 96MHZ/96 = 1.000MHz (Approx)
     P30_INIT_CTR();
     while(1){
         P30_RESET_CTR();