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.

Files at this revision

API Documentation at this revision

Comitter:
mio
Date:
Tue Jun 18 14:18:04 2013 +0000
Parent:
3:603f4efe3985
Commit message:
Wrong comment about MR6 and output pulse duty fix.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 603f4efe3985 -r e7d16ef216d4 main.cpp
--- 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();