AD9832 DDS Sinewave (Based on MLabo's AD9834 DDS Sinewave)
Revision 2:e12ef0540b3c, committed 2012-05-28
- Comitter:
- mio
- Date:
- Mon May 28 01:07:55 2012 +0000
- Parent:
- 1:323280ad1468
- Commit message:
- *FSYNC->FSYN for avoid symbol error when Exported
*library changed from mbed to export
Changed in this revision
diff -r 323280ad1468 -r e12ef0540b3c TextLCD.lib --- a/TextLCD.lib Mon May 28 00:23:21 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/simon/code/TextLCD/#a53b3e2d6f1e
diff -r 323280ad1468 -r e12ef0540b3c export.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/export.bld Mon May 28 01:07:55 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479
diff -r 323280ad1468 -r e12ef0540b3c main.cpp --- a/main.cpp Mon May 28 00:23:21 2012 +0000 +++ b/main.cpp Mon May 28 01:07:55 2012 +0000 @@ -4,13 +4,13 @@ #define XTAL_FREQ ((double)16160000.0) -DigitalOut FSYNC(p8); +DigitalOut FSYN(p8); DigitalOut SCLK(p7); DigitalOut SDATA(p5); Serial pc(USBTX,USBRX); void serial_out(uint16_t data) { - FSYNC = 0; + FSYN = 0; data & 0x8000? SDATA = 1 : SDATA = 0; SCLK = 0; SCLK = 1; data & 0x4000? SDATA = 1 : SDATA = 0; SCLK = 0; SCLK = 1; data & 0x2000? SDATA = 1 : SDATA = 0; SCLK = 0; SCLK = 1; @@ -27,32 +27,32 @@ data & 0x0004? SDATA = 1 : SDATA = 0; SCLK = 0; SCLK = 1; data & 0x0002? SDATA = 1 : SDATA = 0; SCLK = 0; SCLK = 1; data & 0x0001? SDATA = 1 : SDATA = 0; SCLK = 0; SCLK = 1; - FSYNC = 1; + FSYN = 1; } typedef union { - uint32_t UI; - uint8_t B[4]; + uint32_t UI; + uint8_t B[4]; } FREQDATA ; void AD9832_Init(void) { FREQDATA FreqReg ; FreqReg.UI = 0 ; - serial_out(0xF800); - serial_out(0x3300 + FreqReg.B[3]); - serial_out(0x2200 + FreqReg.B[2]); - serial_out(0x3100 + FreqReg.B[1]); - serial_out(0x2000 + FreqReg.B[0]); - serial_out(0xC000); + serial_out(0xF800); + serial_out(0x3300 + FreqReg.B[3]); + serial_out(0x2200 + FreqReg.B[2]); + serial_out(0x3100 + FreqReg.B[1]); + serial_out(0x2000 + FreqReg.B[0]); + serial_out(0xC000); } void AD9832_SetFreq(double freq) { FREQDATA FreqReg ; FreqReg.UI = (uint32_t)(freq * (double)(0x100000000UL) / (XTAL_FREQ) + 0.5); - serial_out(0x3300 + FreqReg.B[3]); - serial_out(0x2200 + FreqReg.B[2]); - serial_out(0x3100 + FreqReg.B[1]); - serial_out(0x2000 + FreqReg.B[0]); + serial_out(0x3300 + FreqReg.B[3]); + serial_out(0x2200 + FreqReg.B[2]); + serial_out(0x3100 + FreqReg.B[1]); + serial_out(0x2000 + FreqReg.B[0]); } int main() { @@ -63,7 +63,7 @@ pc.baud(38400); SCLK = 1; SDATA = 0; - FSYNC = 1; + FSYN = 1; AD9832_Init(); AD9832_SetFreq(60.0) ; while(1) {
diff -r 323280ad1468 -r e12ef0540b3c mbed.bld --- a/mbed.bld Mon May 28 00:23:21 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912