This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

code for adc and dac

i need some example codes for adc and dac using lpc2378 in ARM7

Parents
  • I hope this helps...

    /*
    **======================================================================
    **      Sex_Reflex
    **======================================================================
    **
    **  An example
    **
    **----------------------------------------------------------------------
    **
    **  Parameters Passed:      <void>
    **  Parameters Returned:    <void>
    **  Notes:
    **
    **----------------------------------------------------------------------
    */
    void Sex_Reflex( void )
    {
        s16     current_value;
        s16     filtered_value;
    
        /*------------------------------------------------------------------.
        ; You'll never let me, you'll never get me, you'll never get me away;
        '------------------------------------------------------------------*/
        Init_Core( );
    
        /*------------------------------------------------------------------.
        ; Don't ever want me, don't ever love me, I'll just push you away.  ;
        '------------------------------------------------------------------*/
        Init_Internal_ADC( );
    
        /*------------------------------------------------------------------.
        ;  When you plunge through me with your thinning blade,             ;
        ;  I get so turned on, about being slayed.                          ;
        '------------------------------------------------------------------*/
        Init_Internal_DAC( );
    
        /*------------------------------------------------------------------.
        ;  Forever hot bi%ch, hot sex, she burns with SEX REFLEX.           ;
        '------------------------------------------------------------------*/
        Init_Internal_USART1( );
    
        /*------------------------------------------------------------------.
        ; You'll never never try me, or multiply me, I'll make you cut away ;
        '------------------------------------------------------------------*/
        Init_LCD_Screen( );
    
        /*------------------------------------------------------------------.
        ;  You'll just go by me, won't satisfy me,                          ;
        '------------------------------------------------------------------*/
        Print_Boot_Message( PRINT_CHANNEL_LCD );
    
        /*------------------------------------------------------------------.
        ;  I'll just push you out of the way.                               ;
        '------------------------------------------------------------------*/
        Forever_Loop = TRUE;
    
        /*------------------------------------------------------------------.
        ;  When you plunge through me with your thinning blade,             ;
        ;  I get so turned on, about being slayed.                          ;
        '------------------------------------------------------------------*/
        While( Forever_Loop != FALSE )
        {
            current_value = Read_Internal_ADC( CHANNEL_0 );
    
            filtered_value = ADC_Mathematics( CHANNEL_0 );
    
            (void) Output_Internal_DAC( filtered_value );
        }
    
        /*------------------------------------------------------------------.
        ;  It's not the way you love me,                                    ;
        '------------------------------------------------------------------*/
        Prepare_For_Shutdown( ERROR_FOREVER_LOOP );
    
        /*------------------------------------------------------------------.
        ;  hot bi%ch, hot sex, she burns with SEX REFLEX.                   ;
        ;  hot bi%ch, hot sex, she burns with SEX REFLEX.                   ;
        '------------------------------------------------------------------*/
        Blink_LEDs( );
    
        /*------------------------------------------------------------------.
        ; It's not the way you love me, it's not the way you love me,       ;
        ; it's not the way you love me, it's the way that you don't...      ;
        '------------------------------------------------------------------*/
        Shut_Down( REBOOT );
    }
    

    I actually do think that the OP should get a real answer. It doesn't seem like a student request, and if this forum cannot help such a simple request, then that is kind of sad.

    I don't do NXP, so I won't spend the time to answer the OP, but I'm sure that some readers have dealt with the LPC2378 family.

    Please post it if you've got it. I'd like to see it too.

    --Cpt. Vince Foster
    2nd Cannon Place
    Fort Marcy Park, VA

Reply
  • I hope this helps...

    /*
    **======================================================================
    **      Sex_Reflex
    **======================================================================
    **
    **  An example
    **
    **----------------------------------------------------------------------
    **
    **  Parameters Passed:      <void>
    **  Parameters Returned:    <void>
    **  Notes:
    **
    **----------------------------------------------------------------------
    */
    void Sex_Reflex( void )
    {
        s16     current_value;
        s16     filtered_value;
    
        /*------------------------------------------------------------------.
        ; You'll never let me, you'll never get me, you'll never get me away;
        '------------------------------------------------------------------*/
        Init_Core( );
    
        /*------------------------------------------------------------------.
        ; Don't ever want me, don't ever love me, I'll just push you away.  ;
        '------------------------------------------------------------------*/
        Init_Internal_ADC( );
    
        /*------------------------------------------------------------------.
        ;  When you plunge through me with your thinning blade,             ;
        ;  I get so turned on, about being slayed.                          ;
        '------------------------------------------------------------------*/
        Init_Internal_DAC( );
    
        /*------------------------------------------------------------------.
        ;  Forever hot bi%ch, hot sex, she burns with SEX REFLEX.           ;
        '------------------------------------------------------------------*/
        Init_Internal_USART1( );
    
        /*------------------------------------------------------------------.
        ; You'll never never try me, or multiply me, I'll make you cut away ;
        '------------------------------------------------------------------*/
        Init_LCD_Screen( );
    
        /*------------------------------------------------------------------.
        ;  You'll just go by me, won't satisfy me,                          ;
        '------------------------------------------------------------------*/
        Print_Boot_Message( PRINT_CHANNEL_LCD );
    
        /*------------------------------------------------------------------.
        ;  I'll just push you out of the way.                               ;
        '------------------------------------------------------------------*/
        Forever_Loop = TRUE;
    
        /*------------------------------------------------------------------.
        ;  When you plunge through me with your thinning blade,             ;
        ;  I get so turned on, about being slayed.                          ;
        '------------------------------------------------------------------*/
        While( Forever_Loop != FALSE )
        {
            current_value = Read_Internal_ADC( CHANNEL_0 );
    
            filtered_value = ADC_Mathematics( CHANNEL_0 );
    
            (void) Output_Internal_DAC( filtered_value );
        }
    
        /*------------------------------------------------------------------.
        ;  It's not the way you love me,                                    ;
        '------------------------------------------------------------------*/
        Prepare_For_Shutdown( ERROR_FOREVER_LOOP );
    
        /*------------------------------------------------------------------.
        ;  hot bi%ch, hot sex, she burns with SEX REFLEX.                   ;
        ;  hot bi%ch, hot sex, she burns with SEX REFLEX.                   ;
        '------------------------------------------------------------------*/
        Blink_LEDs( );
    
        /*------------------------------------------------------------------.
        ; It's not the way you love me, it's not the way you love me,       ;
        ; it's not the way you love me, it's the way that you don't...      ;
        '------------------------------------------------------------------*/
        Shut_Down( REBOOT );
    }
    

    I actually do think that the OP should get a real answer. It doesn't seem like a student request, and if this forum cannot help such a simple request, then that is kind of sad.

    I don't do NXP, so I won't spend the time to answer the OP, but I'm sure that some readers have dealt with the LPC2378 family.

    Please post it if you've got it. I'd like to see it too.

    --Cpt. Vince Foster
    2nd Cannon Place
    Fort Marcy Park, VA

Children
No data