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

UART help(LPC1114)

Is it possible for me to send a C file over a UART connection to an LPC1114 mcu? The C file has configurations for the mcu, if it is possible how can I do so using C# in Visual Studio.

Parents
  • Ugh.

    Are you really trying to send, as data, a string that contains "WriteRegisterOpt(8, 1, 0x03249249, 0);" and then expect the MCU to execute it?

    You can't do that.

    (The experienced engineers could, but that is complicated)

    You need to write code that reads the data being sent, then upon reception, parse the data to extract the information from it.

    You should send data like "0x55, 0x08, 0x01, 0x03249249, 0x00" where the 0x55 represents the function "WriteRegisterOpt()" function.

    Assuming that you have a receive buffer you have access to, is could look similar to this:

    Receive_Buffer[ 0 ] = 0x55; // This is just an example
    Receive_Buffer[ 1 ] = 0x08; //  of the data you wanted to send
    Receive_Buffer[ 2 ] = 0x01; //  but in array form
    Receive_Buffer[ 3 ] = 0x03;
    Receive_Buffer[ 4 ] = 0x24;
    Receive_Buffer[ 5 ] = 0x92;
    Receive_Buffer[ 6 ] = 0x49;
    Receive_Buffer[ 7 ] = 0x00;
    


    Then you should have the ability to group the data:

    #define COMMAND_WRITEREGISTEROPT   0x55 // Arbitrary value
    
    Command   = Receive_Buffer[ 0 ];   // the arbitrary value that represents 'WriteRegisterOpt'
    Argument1 = Receive_Buffer[ 1 ];   // the 0x08 value
    Argument2 = Receive_Buffer[ 2 ];   // the 0x01 value
    Argument3 = Get_Value( &(Receive_Buffer[ 3 ]) );// where the Get_Value( ) function converts
                                                    // the bytes to that '0x03249249' number
    Argument4 = Receive_Buffer[ 7 ];   // the 0x00 value
    

    Then you can write code that runs your send command:

        if( Command == COMMAND_WRITEREGISTEROPT )
        {
           WriteRegisterOpt( Argument1, Argument2, Argument3, Argument4 );
        }
    

    This is not actual code to implement. This should just give you an idea on what tasks are involved in getting your target code to execute routines (within your code) with parameters

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

Reply
  • Ugh.

    Are you really trying to send, as data, a string that contains "WriteRegisterOpt(8, 1, 0x03249249, 0);" and then expect the MCU to execute it?

    You can't do that.

    (The experienced engineers could, but that is complicated)

    You need to write code that reads the data being sent, then upon reception, parse the data to extract the information from it.

    You should send data like "0x55, 0x08, 0x01, 0x03249249, 0x00" where the 0x55 represents the function "WriteRegisterOpt()" function.

    Assuming that you have a receive buffer you have access to, is could look similar to this:

    Receive_Buffer[ 0 ] = 0x55; // This is just an example
    Receive_Buffer[ 1 ] = 0x08; //  of the data you wanted to send
    Receive_Buffer[ 2 ] = 0x01; //  but in array form
    Receive_Buffer[ 3 ] = 0x03;
    Receive_Buffer[ 4 ] = 0x24;
    Receive_Buffer[ 5 ] = 0x92;
    Receive_Buffer[ 6 ] = 0x49;
    Receive_Buffer[ 7 ] = 0x00;
    


    Then you should have the ability to group the data:

    #define COMMAND_WRITEREGISTEROPT   0x55 // Arbitrary value
    
    Command   = Receive_Buffer[ 0 ];   // the arbitrary value that represents 'WriteRegisterOpt'
    Argument1 = Receive_Buffer[ 1 ];   // the 0x08 value
    Argument2 = Receive_Buffer[ 2 ];   // the 0x01 value
    Argument3 = Get_Value( &(Receive_Buffer[ 3 ]) );// where the Get_Value( ) function converts
                                                    // the bytes to that '0x03249249' number
    Argument4 = Receive_Buffer[ 7 ];   // the 0x00 value
    

    Then you can write code that runs your send command:

        if( Command == COMMAND_WRITEREGISTEROPT )
        {
           WriteRegisterOpt( Argument1, Argument2, Argument3, Argument4 );
        }
    

    This is not actual code to implement. This should just give you an idea on what tasks are involved in getting your target code to execute routines (within your code) with parameters

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

Children
No data