Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: UITDSP_ADDA mbed
Diff: main.cpp
- Revision:
- 8:abd11816e480
- Parent:
- 6:bb0e5ef9befe
diff -r 1f6af7b67de4 -r abd11816e480 main.cpp
--- a/main.cpp Sat Nov 15 06:07:42 2014 +0000
+++ b/main.cpp Mon Nov 16 02:23:51 2015 +0000
@@ -2,21 +2,19 @@
// FIR フィルタ,基本的な構造, 固定小数点演算を使う
// Analog Input : A0
// Analog Output: MCP4922 using SPI
-// 2014/11/12, Copyright (c) 2014 MIKAMI, Naoki
+// 2015/11/16, Copyright (c) 2015 MIKAMI, Naoki
//--------------------------------------------------------------
-#include "mbed.h"
-
-#include "ADC_Base.hpp" // for ADC not using interrupt
-#include "DAC_MCP4922.hpp" // for DAC MCP4922
+#include "ADC_BuiltIn.hpp" // for ADC not using interrupt
+#include "DAC_MCP4921.hpp" // for DAC MCP4921, MCP4922
#include "Coefficients_200_LPF_Fixed.hpp"
using namespace Mikami;
const int FS_ = 12000; // Sampling frequency: 12 kHz
const uint16_t OFFSET = 2047; // Correspond to "0"
-ADC_Base adc_(A0, FS_); // for AD
-DAC_MCP4922 myDac_; // for DA
+ADC_BuiltIn adc_(A0, FS_); // for AD
+DAC_MCP4921 myDac_; // for DA
int main()
{
@@ -39,7 +37,7 @@
xn[k] = xn[k-1]; // move input signals
// rounding and devide by 32768 + DC offset
- uint16_t yOut = ((yn + 0x8000) >> 15) + OFFSET;
+ uint16_t yOut = ((yn + 0x4000) >> 15) + OFFSET;
//-----------------------------------------------
myDac_.Write(yOut); // Write to DAC
}