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
Revision 8:cc4b26bd80b3, committed 2015-04-24
- Comitter:
- martisalvad
- Date:
- Fri Apr 24 00:36:33 2015 +0000
- Parent:
- 7:016ffe2ef416
- Commit message:
- bpskk 10 periods pr symbol square wave
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 016ffe2ef416 -r cc4b26bd80b3 main.cpp
--- a/main.cpp Tue Apr 21 01:58:55 2015 +0000
+++ b/main.cpp Fri Apr 24 00:36:33 2015 +0000
@@ -179,84 +179,35 @@
//fOut = fMCLK / 2^28 * FREQREG = 50e6 / 2^28 * FREQREG
//FREQREG = fOut * 2^28 / 50e6 = fOut * 5.36870912
//100K: 536870, 1 MHz: 5368709, 2 MHz: 10737418, 3 MHz: 16106127, 4 MHz: 21474836, 8 MHz: 42949673 MHz, 20 MHz: 107374182, Max: 0x3FFF
- setFrequencyWord(0, 16772); // 500K
+ setFrequencyWord(0, 536871); // freq 100kHz - period 1 us
setFrequencyWord(1, 0x3FFF);
selectFrequency(0);
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;
- int count = 0;
- int data[11] = {1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1};
+
- selectPhase(1);
- wait_ms(1000);
-
- //freq is 32kHz for some reason?
+ // BPSK test
while(1){
-
+
+ selectPhase(0);
+ wait_us(100); // send a symbol during 10 T; T = 1/fc; T = 10us = 1/100kHz
- if (data[count]){
-
- //manchester
- //selectPhase(0);
- //wait_us(15);
- //selectPhase(1);
- //wait_us(15);
- //bpsk
- selectPhase(0);
- wait_us(31);
-
-
- }else{
-
- //manchester
- //selectPhase(1);
- //wait_us(15);
- //selectPhase(0);
- //wait_us(15);
- //bpsk
- selectPhase(1);
- wait_us(31);
-
- }
-
- count++;
- if (count > 10){
- count = 0;
-
- selectPhase(1);
- wait_us(600);
-
- }
+ selectPhase(1);
+ wait_us(100);
+
+ }
-
-
-
- }
-
-
-/*
- // FOR A SQUARE WAVE:
- setSignOutput(SIGN_OUTPUT_MSB);
- //open the DDS output
- SQUARE = 1;
-*/
}