Jump to content

hobron9

Members
  • Content Count

    9
  • Joined

  • Last visited

About hobron9

  • Rank
    Noob Class

Profile Information

  • Location
    Pittsburgh, PA
  • Interests
    amateur radio
  1. Thanks, I'll do that. Update, I just removed two ; and two= and the program runs as expected. I just now need to enhance a couple of things and it is done. Thanks for your help, you pointed me in the right direction, and that tutorial is great, much better than the C programming text book I have. Now,, on to a visual basic program for the PC end of this.
  2. Can anyone explain why the long variable 'frequency' will not change based on pin status? (loop function) I know I must be doing something wrong but I can't seem to figure it out. The program as written works. I type in for example 7000000 and the DDS programs to 7.0 Mhz. If a pin is pulled low I want to add or subtract 1500. But that part does not work. It always sets the DDS to the input frequency. I've added print statements to verify what is happening and I know the program is detecting pin state OK. so something is wrong with my logic for adding or subtracting. file attached: AD9850controller3.ino
  3. Thanks, that solved the problem. The DDS now programs to the frequency I send it via the serial monitor and then reflects it back. I just now need to have it maintain the frequency as it resets after a couple of seconds. I used the code you suggested above. How do I latch the 'frequency' data till I send new data? It resets 'frequency' to zero and re-sends it to reset the DDS. I need to store that data somewhere or don't resend until new data is received from the serial monitor. Got it to work. Not great coding but added a goto to jump over sendFrequency(frequency). if (frequency<1000) goto here: with here: below in loop function. Now it doesn't send unless valid data is entered and DDS stays on last programmed frequency. Thanks so much for your help!
  4. I've uploaded a picture of my board setup to control the DDS on left. I do think there is something wrong with the serial setup since I loaded and ran the 4. communications example and it did not put out anything when reset to the serial monitor. I also put some print statements into some code and saw no output to the serial monitor. Data is definitely not being input into the program. It's probably something simple I've overlooked and I really appreciate your help. By the way, I set the com port on com1, com2, com3 and com4 with only com4 reflecting back what I typed into the serial monitor.
  5. I must be missing something. Is there any way to see what has been loaded into 'frequency'? In other compilers I've used you could just put 'debug' on the line and it would display values. I put in the code you suggested and added sendFrequency (frequency); but still nothing. The program does compile and load. Serial monitor does print what I sent. It appears that nothing is being loaded into 'frequency' or it is not what I sent from the serial monitor. I put in a number such as 7222222 to see if it was dropping zeros but still no results. But, if I put in a number directly in the frequency space, the DDS sets to the sendFrequency (7200000); (7.200000 Mhz) correctly. I just tried something else. I thought maybe since long frequency was declared in the loop routine it would be a local variable and not available outside the function so I instead made it a global variable but still no results. I then made it equal to 7200000 and on reset the program sets dds to that frequency. I still can not get the serial input to load into the frequency variable for some reason. I'll keep plugging along.
  6. Thanks, I'll try that. Just a thought, do I need to jumper the RXD and TXD pins (P1_1 AND P1_2) on the board as well as the TX and RX pins in the jumper field? I'm using a ver 1.3 board so the jumpers are different than 1.5.
  7. Thanks for the input; I tried your suggestion but still no results. I used the routine in 4. communications for serial event. The input from the serial monitor does not seem to be assigned to 'frequency'. Number sent from the serial input reflects back and prints of the serial monitor. I must be missing something. It's getting late so I will get back to it tomorrow.
  8. To clarify the above topic, can anyone suggest a way to make the serial data sent via the usb port from the pc using the serial monitor function, available to load into a variable that I can plug into the program and use to set the frequency of the dds? I want to input a number from 1000000 to 30000000. I can't find an example anywhere. Thanks
  9. Hi everyone, I'm new to launchpad and I want to control a DDS ad9850 module using launchpad. I got this program to work so far. It compiles and uploads OK. It will set the frequency I want and I have added serial input via USB and it works in that it answers back whatever I send via the serial monitor (using energia). What I can't figure out, is how to take the data I send via the serial monitor to be put into the field at the bottom of the program ("sendFrequency"). It's now set to 7.255 Mhz If I change the number there, the DDS will change to that frequency, so the link to the serial data from the serial monitor is missing. Can anyone help? The program as it is now is shown below: I'm using a launchpad MSP-EXP430G2 and 430G2553 micro. #include <msp430g2553.h> /* *modified april 2 2015 by j. forkin to convert arduino to launchpad * A simple single freq AD9850 launchpad test script * Original AD9851 DDS sketch by Andrew Smallbone at www.rocketnumbernine.com * Modified for testing the inexpensive AD9850 ebay DDS modules * Pictures and pinouts at nr8o.dhlpilotcentral.com * Use freely */ #define W_CLK 7 // Pin 7 - connect to AD9850 module word load clock pin (CLK) #define FQ_UD 10 // Pin 10 - connect to freq update pin (FQ) #define DATA 9 // Pin 9 - connect to serial data load pin (DATA) #define RESET 8 // Pin 8 - connect to reset pin (RST). #define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); } double freq2; // transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line void tfr_byte(byte data) { for (int i=0; i<8; i++, data>>=1) { digitalWrite(DATA, data & 0x01); pulseHigh(W_CLK); //after each bit sent, CLK is pulsed high } } // frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32 void sendFrequency(double frequency) { int32_t freq = frequency * 4294967295/125000000; // note 125 MHz clock on 9850 for (int b=0; b<4; b++, freq>>=8) { tfr_byte(freq & 0xFF); } tfr_byte(0x000); // Final control byte, all 0 for 9850 chip pulseHigh(FQ_UD); // Done! Should see output } //added this code to talk serially void setup() { // configure launchpad data pins for output pinMode(FQ_UD, OUTPUT); pinMode(W_CLK, OUTPUT); pinMode(DATA, OUTPUT); pinMode(RESET, OUTPUT); pulseHigh(RESET); pulseHigh(W_CLK); pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10 } void loop() { sendFrequency(7255000); // freq THIS IS THE FIELD I NEED TO TIE TO THE SERIAL MONITOR INPUT ////////////////// while(1); }
×
×
  • Create New...