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:
- 4:42262a293f60
- Parent:
- 3:c2b09e28978a
- Child:
- 5:4ef14f22e7b1
--- a/main.cpp Mon Apr 06 18:06:52 2015 +0000
+++ b/main.cpp Thu Apr 16 19:21:35 2015 +0000
@@ -117,9 +117,9 @@
#define REG_RESET 0x0100
void reset(bool in_reset) {
if(in_reset) {
- m_reg |= REG_RESET;
+ m_reg |= REG_RESET; // the reset pin goes up
} else {
- m_reg &= ~REG_RESET;
+ m_reg &= ~REG_RESET; // the reset pin goes down
}
writeReg(m_reg); //writes 16 bits over SPI
}
@@ -166,6 +166,7 @@
//nCS lines
DDS_nCS = 1;
ADC_nCS = 1;
+ CURRENT = 0;
//init spi
SPI_AFE_ADC_AND_DDS.format(16,2);
@@ -178,15 +179,34 @@
//fOut = fMCLK / 2^28 * FREQREG = 50e6 / 2^28 * FREQREG
//FREQREG = fOut * 2^28 / 50e6 = fOut * 5.36870912
//1 MHz: 5368709, 2 MHz: 10737418, 3 MHz: 16106127, 4 MHz: 21474836, 8 MHz: 42949673 MHz, 20 MHz: 107374182, Max: 0x3FFF
- setFrequencyWord(0, 42949673);
+ setFrequencyWord(0, 5368709); // 500K
setFrequencyWord(1, 0x3FFF);
selectFrequency(0);
+
+ setSignOutput(SIGN_OUTPUT_NONE); //set SIGN BIT OUT to Z
+ setOutputMode(OUTPUT_MODE_SINE);
+ DDS = 1;
- //setOutputMode(OUTPUT_MODE_SINE);
+/* // FOR A SQUARE WAVE:
setSignOutput(SIGN_OUTPUT_MSB);
- //setSignOutput(SIGN_OUTPUT_COMPARATOR); //max output freq appx 6.357 MHz?
//open the DDS output
SQUARE = 1;
+*/
+// SQUARE = 0;
+// DDS = 1;
+/*
+ int i;
+ float frequencies[] = {100,50,33,25,20,17,14,12,11,10,9,8};
+
+ while(1) {
+ for( i=0; i< sizeof(frequencies)/sizeof(float); i++) {
+ setFrequencyWord(0, (int)((float)(2<<27) / frequencies[i]));
+ selectFrequency(0);
+ wait_ms(2000);
+ LED_3 = !LED_3;
+ }
+ wait_ms(3000);
+ }
#define bit_up_time 8 //8 for no logic
#define bit_guard_time 8 //8 for no logic
@@ -199,8 +219,8 @@
uint8_t bytecount = 0, bitcount = 0;
int32_t freq = 0;
uint8_t freqRegister = 0;
-
-
+*/
+/*
__disable_irq();
while(1) {
for (bytecount=0; bytecount<data_len; bytecount++){
@@ -233,5 +253,5 @@
}//end while
__enable_irq();
-
+*/
}