Jump to content
43oh

gonya707

Members
  • Content Count

    19
  • Joined

  • Last visited

  • Days Won

    4

Reputation Activity

  1. Like
    gonya707 got a reaction from Smakkemeken in HAPPY NEW YEAR!!!   
    Happy new year everybody
  2. Like
    gonya707 got a reaction from RobG in AD9850 Library (DDS function generator)   
    Hi there. First of all I'm not sure if I should post this here or inside another section fo the forum, apologies if I made a mistake.
     

     
    Probably some of you already know this IC, the AD9850. Its a sine and square wave generator with output frequencies between 0Hz and...more than 60MHz! Due to its very low price (around $5 on eBay) and usefulness, it is definitively a module everybody should have if you can't afford a function generator. This library comes with several functions you might find useful:
    /* Starts AD9850 operation changing its value to "all zeros". * Refreshes previous status from the microcontroller.*/ void AD9850_Init(void); /* Reset operation for the AD9850. This function must be called before using AD9850_Osc * first time in the execution (check page 12 on datasheet) */ void AD9850_Reset(void); /* Sets the DDS sine and square oscillator to the detailed "frequency" and "phase" variables. * "frequency" will be turned into a 32 bit word, so the frequency will have a resolution of 0.0291 Hz * with a 125 MHz reference clock. "phase" will be a 5 bit word instead so the resolution is * 11.5 degrees, or pi/32 radians. */ void AD9850_Osc(double frequency, double phase); /* Enables power down mode. This method is used for a quick "all outputs" disable. * The effect is the same as AD9850_Osc(0,0), but it takes less clock cycles */ void AD9850_PowerDown(void); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high * and resets to the lower frequency when maximum frequency is reached. */ void AD9850_Sweep_Up(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep decreased in "inc"Hz steps. The frequency order is from high to low * and resets to the higher frequency when minimum frequency is reached. */ void AD9850_Sweep_Down(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high, * but it changes to from high to low when the maximum frequency is reached and so on. */ void AD9850_Sweep_Loop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); Inside your main code you only need to include the library and init the module:
    //AD9850 config SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //frequency = 10000Hz, phase = 0 rad AD9850_Osc(10000, 0); And that's it. You can download the codes attached to this post. I hope you find them useful.
    STELLARIS_AD9850.c
    STELLARIS_AD9850.h
  3. Like
    gonya707 got a reaction from bluehash in FM synthesizer   
    This is a FM synthesizer made for the Stellarpad using the AD9850 function generator.
     


    The FM synthesis is teorethicaly the same as the all-known frequency modoulation used for radio communications, but in this case the frequencies are suited to stay at the audio range, i.e. from 20Hz to 20kHz. Basically The AD9850 is used as a sine wave generator, and the microcontroller create each cycle a sample of ANOTHER sine wave, this one goes from 5Hz to 100Hz more or less. We can modulate this two sinewaves, the AD signal being the carrier and the stellaris signal the baseband. The outcoming spectrum can be represented by the Bessel functions for each harmonic, making some interesting sounds for electronic music. Attaching two potentiometers we can control the baseband sine frequency and its amplitude, thus controlling the modulation index.

    This is a recording I made with this project (is there any way to display souncloud embed on the forum?):

    https://soundcloud.com/gonya707/fm-synthesizer-grsynth-com

    The first seconds were non-modulated waves and then I pressed a note (C3 if I recall correctly) and played with the potentiometers..
     
    This is a simplfied schematic of the project.
     

     
    The complete schematic of each module can be found respectively here:
     
    AD9850 module: http://www.analog.com/static/imported-files/data_sheets/AD9850.pdf
    MIDI boosterpack by RobG: http://forum.43oh.com/topic/1773-midi-booster-pack/page-3#entry23763
     
     
    And finally, this is the main code for this project:
    // // FM Synthesizer for Stellaris Launchpad and AD9850 // Coded by Gonzalo Recio // #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "inc/hw_gpio.h" #include "inc/hw_sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/uart.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "driverlib/adc.h" #include "math.h" #include "midi.h" #include "STELLARIS_AD9850.h" #define PI 3.141592 #define GPIO_PB0_U1RX 0x00010001 #define GPIO_PB1_U1TX 0x00010401 // Global variables unsigned long message; unsigned long note, velocity; int on=0, off=0; int flagON = 0, flagOFF = 0; unsigned short i = 0, z,y; float t = 0; float freq = 0; unsigned long ulADC0_Value[4]; int main(void){ //50MHz clock SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); //enable UART for MIDI T/R SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); GPIOPinConfigure(GPIO_PB0_U1RX); //B0 receptor GPIOPinConfigure(GPIO_PB1_U1TX); //B1 transmitter GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 31250, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE) ); //enable AD9850 SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //ADC0 config SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); ADCHardwareOversampleConfigure(ADC0_BASE, 4); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4|GPIO_PIN_5); ADCSequenceStepConfigure(ADC0_BASE, 1 , 0 , ADC_CTL_CH8 ); ADCSequenceStepConfigure(ADC0_BASE, 1 , 1 , ADC_CTL_CH9 | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); ADCIntClear(ADC0_BASE, 1); //Begin the interrupt detection IntMasterEnable(); IntEnable(INT_UART1); UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT); while(1){ if (on == off){ AD9850_PowerDown(); } else{ ADCProcessorTrigger(ADC0_BASE, 1 ); while(!ADCIntStatus(ADC0_BASE, 1 , false)){ } ADCIntClear(ADC0_BASE, 1 ); ADCSequenceDataGet(ADC0_BASE, 1 , ulADC0_Value); AD9850_Osc(freq + y*sin(t), 0); } z=(ulADC0_Value[0] / 4 ) + 1; y=(ulADC0_Value[1]); i=(i + 1) % z; //timescale between 0 and 2*pi t=((float)i / (float)z ) * 2 * PI; } } //uart1handler void UARTIntHandler(void){ IntDisable(INT_UART1); unsigned long ulStatus = UARTIntStatus(UART1_BASE, true); //get interrupt status. RX or RT? UARTIntClear(UART1_BASE, ulStatus); //clear the asserted interrupts while(UARTCharsAvail(UART1_BASE)){ //loop while there are chars message = UARTCharGetNonBlocking(UART1_BASE); if(flagON){ // if the last message was a note ON, then this message is on++; // the note code. if (note != message){ note = message; freq = code2Freq(note); } } else if(flagOFF){ off++; } flagON = isNoteOn(message); flagOFF = isNoteOff(message); } IntEnable(INT_UART1); } The codes for the AD9850 library were also made by me, you can find them in this other thread.
    The MIDI library used in this project is here midi.c, midi.h. I was also the author for this one.

    If you don't have a MIDI boosterpack I've made also a no-MIDI version, the on-board switches trigger two different notes. You still need to attach a potentiometer to E4 and E5 though. You can find this version HERE.
  4. Like
    gonya707 got a reaction from bluehash in [ ENDED ] 43oh-Stellarisiti Nov 2013- Jan 2014 Project Of The Month   
    This is a FM synthesizer made for the Stellarpad using the AD9850 function generator.
     


    The FM synthesis is teorethicaly the same as the all-known frequency modoulation used for radio communications, but in this case the frequencies are suited to stay at the audio range, i.e. from 20Hz to 20kHz. Basically The AD9850 is used as a sine wave generator, and the microcontroller create each cycle a sample of ANOTHER sine wave, this one goes from 5Hz to 100Hz more or less. We can modulate this two sinewaves, the AD signal being the carrier and the stellaris signal the baseband. The outcoming spectrum can be represented by the Bessel functions for each harmonic, making some interesting sounds for electronic music. Attaching two potentiometers we can control the baseband sine frequency and its amplitude, thus controlling the modulation index.

    This is a recording I made with this project (is there any way to display souncloud embed on the forum?):

    https://soundcloud.com/gonya707/fm-synthesizer-grsynth-com

    The first seconds were non-modulated waves and then I pressed a note (C3 if I recall correctly) and played with the potentiometers..
     
    This is a simplfied schematic of the project.
     

     
    The complete schematic of each module can be found respectively here:
     
    AD9850 module: http://www.analog.com/static/imported-files/data_sheets/AD9850.pdf
    MIDI boosterpack by RobG: http://forum.43oh.com/topic/1773-midi-booster-pack/page-3#entry23763
     
     
    And finally, this is the main code for this project:
     
    // // FM Synthesizer for Stellaris Launchpad and AD9850 // Coded by Gonzalo Recio // #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "inc/hw_gpio.h" #include "inc/hw_sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/uart.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "driverlib/adc.h" #include "math.h" #include "midi.h" #include "STELLARIS_AD9850.h" #define PI 3.141592 #define GPIO_PB0_U1RX 0x00010001 #define GPIO_PB1_U1TX 0x00010401 // Global variables unsigned long message; unsigned long note, velocity; int on=0, off=0; int flagON = 0, flagOFF = 0; unsigned short i = 0, z,y; float t = 0; float freq = 0; unsigned long ulADC0_Value[4]; int main(void){ //50MHz clock SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); //enable UART for MIDI T/R SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); GPIOPinConfigure(GPIO_PB0_U1RX); //B0 receptor GPIOPinConfigure(GPIO_PB1_U1TX); //B1 transmitter GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 31250, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE) ); //enable AD9850 SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //ADC0 config SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); ADCHardwareOversampleConfigure(ADC0_BASE, 4); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4|GPIO_PIN_5); ADCSequenceStepConfigure(ADC0_BASE, 1 , 0 , ADC_CTL_CH8 ); ADCSequenceStepConfigure(ADC0_BASE, 1 , 1 , ADC_CTL_CH9 | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); ADCIntClear(ADC0_BASE, 1); //Begin the interrupt detection IntMasterEnable(); IntEnable(INT_UART1); UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT); while(1){ if (on == off){ AD9850_PowerDown(); } else{ ADCProcessorTrigger(ADC0_BASE, 1 ); while(!ADCIntStatus(ADC0_BASE, 1 , false)){ } ADCIntClear(ADC0_BASE, 1 ); ADCSequenceDataGet(ADC0_BASE, 1 , ulADC0_Value); AD9850_Osc(freq + y*sin(t), 0); } z=(ulADC0_Value[0] / 4 ) + 1; y=(ulADC0_Value[1]); i=(i + 1) % z; //timescale between 0 and 2*pi t=((float)i / (float)z ) * 2 * PI; } } //uart1handler void UARTIntHandler(void){ IntDisable(INT_UART1); unsigned long ulStatus = UARTIntStatus(UART1_BASE, true); //get interrupt status. RX or RT? UARTIntClear(UART1_BASE, ulStatus); //clear the asserted interrupts while(UARTCharsAvail(UART1_BASE)){ //loop while there are chars message = UARTCharGetNonBlocking(UART1_BASE); if(flagON){ // if the last message was a note ON, then this message is on++; // the note code. if (note != message){ note = message; freq = code2Freq(note); } } else if(flagOFF){ off++; } flagON = isNoteOn(message); flagOFF = isNoteOff(message); } IntEnable(INT_UART1); } The codes for the AD9850 library were also made by me, you can find them in this other thread.
    The MIDI library used in this project is here midi.c, midi.h. I was also the author for this one.

    If you don't have a MIDI boosterpack I've made also a no-MIDI version, the on-board switches trigger two different notes. You still need to attach a potentiometer to E4 and E5 though. You can find this version HERE.
  5. Like
    gonya707 got a reaction from RobG in AD9850 (DDS function generator) for Energia   
    This is the Energia version of the library I shared here. You can find this function generator module easily in eBay for about $5
     
    It has the same functions but this time the library features a object-oriented structure, which allows to manage several AD9850 modules at once. It works perfectly for both MSP430 and Stellarpad boards (tested), you just need to change the given pin numbers when you create the AD9858 class instance.
    class AD9850{ public: AD9850(int givenW_CLK, int givenFQ_UD, int givenDATA, int givenRESET); void init(); void doReset(); void osc(double Freq,double phase); void sweepUp(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepDown(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepLoop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void powerDown(); private: int W_CLK; int FQ_UD; int DATA; int RESET; }; This is a main code example for the Stellarpad:
    #include "ENERGIA_AD9850.h" void setup(){ pinMode(PE_5, OUTPUT); pinMode(PA_5, OUTPUT); pinMode(PA_6, OUTPUT); pinMode(PA_7, OUTPUT); AD9850 device(PE_5, PA_5, PA_6, PA_7); device.init(); device.doReset(); // min frequency = 1Hz, max frequency = 10000Hz // 1Hz steps, waiting 1000 Cycles between changing frequency. device.sweepLoop(1, 10000, 1, 1000); } void loop(){} //do nothing And the result will be something like this:
     

     
     
    You can download the codes attached to this post. Please unlock cpp and .h this time sorry for the inconvenience.
     
    You can temporally download them here. 
     
     
     
    .cpp
    .h
     
  6. Like
    gonya707 got a reaction from energia in AD9850 (DDS function generator) for Energia   
    This is the Energia version of the library I shared here. You can find this function generator module easily in eBay for about $5
     
    It has the same functions but this time the library features a object-oriented structure, which allows to manage several AD9850 modules at once. It works perfectly for both MSP430 and Stellarpad boards (tested), you just need to change the given pin numbers when you create the AD9858 class instance.
    class AD9850{ public: AD9850(int givenW_CLK, int givenFQ_UD, int givenDATA, int givenRESET); void init(); void doReset(); void osc(double Freq,double phase); void sweepUp(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepDown(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepLoop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void powerDown(); private: int W_CLK; int FQ_UD; int DATA; int RESET; }; This is a main code example for the Stellarpad:
    #include "ENERGIA_AD9850.h" void setup(){ pinMode(PE_5, OUTPUT); pinMode(PA_5, OUTPUT); pinMode(PA_6, OUTPUT); pinMode(PA_7, OUTPUT); AD9850 device(PE_5, PA_5, PA_6, PA_7); device.init(); device.doReset(); // min frequency = 1Hz, max frequency = 10000Hz // 1Hz steps, waiting 1000 Cycles between changing frequency. device.sweepLoop(1, 10000, 1, 1000); } void loop(){} //do nothing And the result will be something like this:
     

     
     
    You can download the codes attached to this post. Please unlock cpp and .h this time sorry for the inconvenience.
     
    You can temporally download them here. 
     
     
     
    .cpp
    .h
     
  7. Like
    gonya707 got a reaction from larryfraz in Stellaris Drum Machine   
    How come I didn't see this before?
     
    I'm already working on the MIDI support for this, and probably I'll make a drum version of my MIDI sequencer. Thank you for this useful resource.
  8. Like
    gonya707 got a reaction from energia in AD9850 Library (DDS function generator)   
    Hi there. First of all I'm not sure if I should post this here or inside another section fo the forum, apologies if I made a mistake.
     

     
    Probably some of you already know this IC, the AD9850. Its a sine and square wave generator with output frequencies between 0Hz and...more than 60MHz! Due to its very low price (around $5 on eBay) and usefulness, it is definitively a module everybody should have if you can't afford a function generator. This library comes with several functions you might find useful:
    /* Starts AD9850 operation changing its value to "all zeros". * Refreshes previous status from the microcontroller.*/ void AD9850_Init(void); /* Reset operation for the AD9850. This function must be called before using AD9850_Osc * first time in the execution (check page 12 on datasheet) */ void AD9850_Reset(void); /* Sets the DDS sine and square oscillator to the detailed "frequency" and "phase" variables. * "frequency" will be turned into a 32 bit word, so the frequency will have a resolution of 0.0291 Hz * with a 125 MHz reference clock. "phase" will be a 5 bit word instead so the resolution is * 11.5 degrees, or pi/32 radians. */ void AD9850_Osc(double frequency, double phase); /* Enables power down mode. This method is used for a quick "all outputs" disable. * The effect is the same as AD9850_Osc(0,0), but it takes less clock cycles */ void AD9850_PowerDown(void); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high * and resets to the lower frequency when maximum frequency is reached. */ void AD9850_Sweep_Up(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep decreased in "inc"Hz steps. The frequency order is from high to low * and resets to the higher frequency when minimum frequency is reached. */ void AD9850_Sweep_Down(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high, * but it changes to from high to low when the maximum frequency is reached and so on. */ void AD9850_Sweep_Loop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); Inside your main code you only need to include the library and init the module:
    //AD9850 config SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //frequency = 10000Hz, phase = 0 rad AD9850_Osc(10000, 0); And that's it. You can download the codes attached to this post. I hope you find them useful.
    STELLARIS_AD9850.c
    STELLARIS_AD9850.h
  9. Like
    gonya707 got a reaction from Rickta59 in AD9850 (DDS function generator) for Energia   
    This is the Energia version of the library I shared here. You can find this function generator module easily in eBay for about $5
     
    It has the same functions but this time the library features a object-oriented structure, which allows to manage several AD9850 modules at once. It works perfectly for both MSP430 and Stellarpad boards (tested), you just need to change the given pin numbers when you create the AD9858 class instance.
    class AD9850{ public: AD9850(int givenW_CLK, int givenFQ_UD, int givenDATA, int givenRESET); void init(); void doReset(); void osc(double Freq,double phase); void sweepUp(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepDown(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepLoop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void powerDown(); private: int W_CLK; int FQ_UD; int DATA; int RESET; }; This is a main code example for the Stellarpad:
    #include "ENERGIA_AD9850.h" void setup(){ pinMode(PE_5, OUTPUT); pinMode(PA_5, OUTPUT); pinMode(PA_6, OUTPUT); pinMode(PA_7, OUTPUT); AD9850 device(PE_5, PA_5, PA_6, PA_7); device.init(); device.doReset(); // min frequency = 1Hz, max frequency = 10000Hz // 1Hz steps, waiting 1000 Cycles between changing frequency. device.sweepLoop(1, 10000, 1, 1000); } void loop(){} //do nothing And the result will be something like this:
     

     
     
    You can download the codes attached to this post. Please unlock cpp and .h this time sorry for the inconvenience.
     
    You can temporally download them here. 
     
     
     
    .cpp
    .h
     
  10. Like
    gonya707 got a reaction from Automate in AD9850 (DDS function generator) for Energia   
    This is the Energia version of the library I shared here. You can find this function generator module easily in eBay for about $5
     
    It has the same functions but this time the library features a object-oriented structure, which allows to manage several AD9850 modules at once. It works perfectly for both MSP430 and Stellarpad boards (tested), you just need to change the given pin numbers when you create the AD9858 class instance.
    class AD9850{ public: AD9850(int givenW_CLK, int givenFQ_UD, int givenDATA, int givenRESET); void init(); void doReset(); void osc(double Freq,double phase); void sweepUp(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepDown(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void sweepLoop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); void powerDown(); private: int W_CLK; int FQ_UD; int DATA; int RESET; }; This is a main code example for the Stellarpad:
    #include "ENERGIA_AD9850.h" void setup(){ pinMode(PE_5, OUTPUT); pinMode(PA_5, OUTPUT); pinMode(PA_6, OUTPUT); pinMode(PA_7, OUTPUT); AD9850 device(PE_5, PA_5, PA_6, PA_7); device.init(); device.doReset(); // min frequency = 1Hz, max frequency = 10000Hz // 1Hz steps, waiting 1000 Cycles between changing frequency. device.sweepLoop(1, 10000, 1, 1000); } void loop(){} //do nothing And the result will be something like this:
     

     
     
    You can download the codes attached to this post. Please unlock cpp and .h this time sorry for the inconvenience.
     
    You can temporally download them here. 
     
     
     
    .cpp
    .h
     
  11. Like
    gonya707 got a reaction from PTB in AD9850 Library (DDS function generator)   
    Hi there. First of all I'm not sure if I should post this here or inside another section fo the forum, apologies if I made a mistake.
     

     
    Probably some of you already know this IC, the AD9850. Its a sine and square wave generator with output frequencies between 0Hz and...more than 60MHz! Due to its very low price (around $5 on eBay) and usefulness, it is definitively a module everybody should have if you can't afford a function generator. This library comes with several functions you might find useful:
    /* Starts AD9850 operation changing its value to "all zeros". * Refreshes previous status from the microcontroller.*/ void AD9850_Init(void); /* Reset operation for the AD9850. This function must be called before using AD9850_Osc * first time in the execution (check page 12 on datasheet) */ void AD9850_Reset(void); /* Sets the DDS sine and square oscillator to the detailed "frequency" and "phase" variables. * "frequency" will be turned into a 32 bit word, so the frequency will have a resolution of 0.0291 Hz * with a 125 MHz reference clock. "phase" will be a 5 bit word instead so the resolution is * 11.5 degrees, or pi/32 radians. */ void AD9850_Osc(double frequency, double phase); /* Enables power down mode. This method is used for a quick "all outputs" disable. * The effect is the same as AD9850_Osc(0,0), but it takes less clock cycles */ void AD9850_PowerDown(void); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high * and resets to the lower frequency when maximum frequency is reached. */ void AD9850_Sweep_Up(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep decreased in "inc"Hz steps. The frequency order is from high to low * and resets to the higher frequency when minimum frequency is reached. */ void AD9850_Sweep_Down(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high, * but it changes to from high to low when the maximum frequency is reached and so on. */ void AD9850_Sweep_Loop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); Inside your main code you only need to include the library and init the module:
    //AD9850 config SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //frequency = 10000Hz, phase = 0 rad AD9850_Osc(10000, 0); And that's it. You can download the codes attached to this post. I hope you find them useful.
    STELLARIS_AD9850.c
    STELLARIS_AD9850.h
  12. Like
    gonya707 reacted to bluehash in AD9850 Library (DDS function generator)   
    @@gonya707 Thank you for this snippet!
    I've enabled .h file uploads. You should be ok now.
  13. Like
    gonya707 got a reaction from bluehash in AD9850 Library (DDS function generator)   
    Hi there. First of all I'm not sure if I should post this here or inside another section fo the forum, apologies if I made a mistake.
     

     
    Probably some of you already know this IC, the AD9850. Its a sine and square wave generator with output frequencies between 0Hz and...more than 60MHz! Due to its very low price (around $5 on eBay) and usefulness, it is definitively a module everybody should have if you can't afford a function generator. This library comes with several functions you might find useful:
    /* Starts AD9850 operation changing its value to "all zeros". * Refreshes previous status from the microcontroller.*/ void AD9850_Init(void); /* Reset operation for the AD9850. This function must be called before using AD9850_Osc * first time in the execution (check page 12 on datasheet) */ void AD9850_Reset(void); /* Sets the DDS sine and square oscillator to the detailed "frequency" and "phase" variables. * "frequency" will be turned into a 32 bit word, so the frequency will have a resolution of 0.0291 Hz * with a 125 MHz reference clock. "phase" will be a 5 bit word instead so the resolution is * 11.5 degrees, or pi/32 radians. */ void AD9850_Osc(double frequency, double phase); /* Enables power down mode. This method is used for a quick "all outputs" disable. * The effect is the same as AD9850_Osc(0,0), but it takes less clock cycles */ void AD9850_PowerDown(void); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high * and resets to the lower frequency when maximum frequency is reached. */ void AD9850_Sweep_Up(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep decreased in "inc"Hz steps. The frequency order is from high to low * and resets to the higher frequency when minimum frequency is reached. */ void AD9850_Sweep_Down(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high, * but it changes to from high to low when the maximum frequency is reached and so on. */ void AD9850_Sweep_Loop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); Inside your main code you only need to include the library and init the module:
    //AD9850 config SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //frequency = 10000Hz, phase = 0 rad AD9850_Osc(10000, 0); And that's it. You can download the codes attached to this post. I hope you find them useful.
    STELLARIS_AD9850.c
    STELLARIS_AD9850.h
  14. Like
    gonya707 got a reaction from Automate in AD9850 Library (DDS function generator)   
    Hi there. First of all I'm not sure if I should post this here or inside another section fo the forum, apologies if I made a mistake.
     

     
    Probably some of you already know this IC, the AD9850. Its a sine and square wave generator with output frequencies between 0Hz and...more than 60MHz! Due to its very low price (around $5 on eBay) and usefulness, it is definitively a module everybody should have if you can't afford a function generator. This library comes with several functions you might find useful:
    /* Starts AD9850 operation changing its value to "all zeros". * Refreshes previous status from the microcontroller.*/ void AD9850_Init(void); /* Reset operation for the AD9850. This function must be called before using AD9850_Osc * first time in the execution (check page 12 on datasheet) */ void AD9850_Reset(void); /* Sets the DDS sine and square oscillator to the detailed "frequency" and "phase" variables. * "frequency" will be turned into a 32 bit word, so the frequency will have a resolution of 0.0291 Hz * with a 125 MHz reference clock. "phase" will be a 5 bit word instead so the resolution is * 11.5 degrees, or pi/32 radians. */ void AD9850_Osc(double frequency, double phase); /* Enables power down mode. This method is used for a quick "all outputs" disable. * The effect is the same as AD9850_Osc(0,0), but it takes less clock cycles */ void AD9850_PowerDown(void); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high * and resets to the lower frequency when maximum frequency is reached. */ void AD9850_Sweep_Up(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep decreased in "inc"Hz steps. The frequency order is from high to low * and resets to the higher frequency when minimum frequency is reached. */ void AD9850_Sweep_Down(double minFreq, double maxFreq, double inc, int cyclesPerDelay); /* Performs a frequency sweep increased in "inc"Hz steps. The frequency order is from low to high, * but it changes to from high to low when the maximum frequency is reached and so on. */ void AD9850_Sweep_Loop(double minFreq, double maxFreq, double inc, int cyclesPerDelay); Inside your main code you only need to include the library and init the module:
    //AD9850 config SysCtlPeripheralEnable(PORT_ENABLE); GPIOPinTypeGPIOOutput(PORT, W_CLK|FQ_UD|DATA|RESET); AD9850_Init(); AD9850_Reset(); //frequency = 10000Hz, phase = 0 rad AD9850_Osc(10000, 0); And that's it. You can download the codes attached to this post. I hope you find them useful.
    STELLARIS_AD9850.c
    STELLARIS_AD9850.h
  15. Like
    gonya707 got a reaction from bluehash in RobG's MIDI boosterpack   
    This is my first “big” project for the Stellaris Launchpad. I made a complete MIDI sequencer using the MIDI boosterpack. The operation is very simple, just plug both input and output MIDI connectors and send your note sequence via keyboard or software keyboard. Then the pattern will begin to repeat itself, you can change now the sequence speed or the note velocity changing the potentiometers position and change the entire sequence pitch up or down as well using the on board switches. I made an explanatory video:
     

     
    The main code is attached to this post. You can read some explanations an thoughs on this code in this article.
     
    Have a nice day
    main_sequencer.c
  16. Like
    gonya707 got a reaction from RobG in RobG's MIDI boosterpack   
    Now it's time for a send algorithm I made two codes. The first one send a fixed note and velocity pressing one of the on-board switches and the second one send also notes, but you cand adjust the note and the velocity spinning the boosterpack's potentiometers, simple but effective.
     
    This two codes are good 'skeletons' for several future projects, so hopefully I'll update this thread with cool features soon. Right now I'm thinking about a sequencer.
     
    Both files are attached to this post. As always, I made a detailed explanation of this codes on my blog.
     
    I'd also reccomend to have on your project my MIDI library. you can get it here.
     
     
    I made a video using this example application. Is there any way to embed it? - edit: ok i see it's automatic
     

    midiSendSingle.c
    midiSendMulti.c
  17. Like
    gonya707 got a reaction from bluehash in RobG's MIDI boosterpack   
    Hi there. Probably some of you know already the existence of this MIDI boosterpack published on 43oh forums (check the original thread here).
     

     
    This board is a great tool for musicians and/or audio engineers, it features two DIN-5 MIDI connectors (MIDI IN and MIDI OUT) along with two switches and potentiometers. It allows to receive and send MIDI messages through the mcu's UART modules, and the incorporation of the potentiometers help for applications such as arpeggiators, sequencers, harmonizers and everything you can imagine.
     
    The original author provides some code examples for MSP430 but I's starting to arrange some code for Tiva/Stellaris. First of all I bring to you some basic code for receive and process the input MIDI messages. It would be great if we can use this thread for share more examples suited for Tiva/Stellaris.
     
    I attached mi example file to this post. If you use it on a project don't forget to modify the startup_ccs file. The pinout used is for a LM4F120XL launchpad, so check everything is right before compiling.
     
    For detailed explanations on this code check this article.
     
    Have a nice day!
    midi_bp.c
  18. Like
    gonya707 got a reaction from bluehash in MIDI Booster Pack   
    I just opened a thread on Stelarisiti for this boosterpack. Check it out here.
     
    Thanks again Rob for this wonderful boostepack
  19. Like
    gonya707 got a reaction from RobG in MIDI Booster Pack   
    I just opened a thread on Stelarisiti for this boosterpack. Check it out here.
     
    Thanks again Rob for this wonderful boostepack
×
×
  • Create New...