lpcware

Receipt UART data to send it to SSP

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by simon.lefils on Mon Feb 04 06:20:13 MST 2013
hello everybody !

I have used a code source example for UART in order to comunicate with terminal (cutecom) on linux.
I arrive to send and receive data with cutecom ( I use a FTDI for USB --> UART that i have plugged on LPC11U14).
My program work.

Now, I want to send the data that i recovers in UARTbuffer to SPIbuffer?

So in my project files, I have imported SSP.C and SSP.h (I found on website)
This SSP.c file allows to do a Loopback test, write/read on SEEROM or communicate with Master and slave.
I ask me how we can send directly data...
So my first idea is to create a global variable( a table)  and copy the UARTbuffer to SPIbuffer.

How i could do it ? I write an example on the fly



int main ()
{     int8_t toto;
      uint8_t* ptoto=&toto;

     SystemInit();
     UARTInit(9600);
     SSP_IOConfig( SSP_NUM ); // allows to configure IO SSP
     SSP_Init( SSP_NUM ); // allows to initialize SSP

while(1)
        {

            if(UartFlag==UART_Flag_DataReady) // allows to  know if there are data
            {
    toto = UARTBuffer[0];
    toto = SPIBuffer[0];
            toto +=8;
            UARTSend(ptoto,1);
            SSP_Send( 0,ptoto,1);
            UartFlag=UART_Flag_WaitRx;        //ok for next octet
            }
        }
return 0 ;
}

Thank for your answers


Outcomes