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: mbed
Diff: main.cpp
- Revision:
- 6:b9a883bb1d63
- Parent:
- 5:4ef14f22e7b1
- Child:
- 7:016ffe2ef416
--- a/main.cpp Fri Apr 17 01:10:41 2015 +0000
+++ b/main.cpp Fri Apr 17 22:21:56 2015 +0000
@@ -170,8 +170,8 @@
//init spi
SPI_AFE_ADC_AND_DDS.format(16,2);
- SPI_AFE_ADC_AND_DDS.frequency(33000000);
- /*
+ SPI_AFE_ADC_AND_DDS.frequency(3000000);
+
//make sure SPI is setup to mode 2, MSB first
//init DDS
begin();
@@ -183,27 +183,35 @@
setFrequencyWord(1, 0x3FFF);
selectFrequency(0);
-// setSignOutput(SIGN_OUTPUT_NONE); //set SIGN BIT OUT to Z
-// setOutputMode(OUTPUT_MODE_SINE);
-// DDS = 1;
+
+ setPhaseWord(0, 0); // 0 degrees
+ setPhaseWord(1, 2048); // 180 degrees
+ //setPhaseWord(1, 1024); // 90 degrees
+ //setPhaseWord(1, 512); // 45 degrees
+
+ selectPhase(0);
+
+
+ setSignOutput(SIGN_OUTPUT_NONE); //set SIGN BIT OUT to Z
+ setOutputMode(OUTPUT_MODE_SINE);
+ DDS = 1;
+
+ setSignOutput(SIGN_OUTPUT_MSB);
+ SQUARE = 1;
+
+
+ while(1){
+ selectPhase(0);
+ wait_us(16);
+ selectPhase(1);
+ wait_us(16);
+ }
+/*
// FOR A SQUARE WAVE:
setSignOutput(SIGN_OUTPUT_MSB);
//open the DDS output
SQUARE = 1;
-
-
- int32_t freq = 10737418;
- */
+*/
- while(1)
- {
- writeReg(0x2100);
- writeReg(0x50C7);
- writeReg(0x4000);
- writeReg(0xC000);
- writeReg(0x2000);
-
- wait_ms(1000);
- }
}