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

problem when transmitting the a string data to GPS interface with 8051 uC

void main(void)
{
        unsigned short  l_us_temp;
        //Disable watchdog timer
        WDTCN = 0xDE;
   WDTCN = 0xAD;

        ExtCrystalOsc_Init();

        //Initialise crossbar and GPIO
        Port_Init();

        EMIF_Init();

        //Initialise Timer 0
        Timer0_Init();

        //Initialise Timer 2
        Timer2_Init();

        //Initialise Timer 4
        Timer4_Init();

        //Initialise UART0
        UART0_Init();

        //Initialise UART1
        UART1_Init();

        //Initialise ADC
        ADC0_Init();

        //Initialise DAC
        DAC0_Init();
        DAC1_Init();

        //Initialise PCA0
        PCA0_Init();

        //Initialise INT0_N & INT1_N
        Ext_Interrupt_Init();

//lsl : 04 Jan 2011 : 0852hrs : disable Watchdog timer temporarily
        //Initialise Watchdog Timer
//      Watchdog_Init();

        //Initialise SPI0
        SPI0_Init();

        //------------------------
        //Reset IMU-A, IMU-B & GPS

   SFRPAGE = CONFIG_PAGE;

        IMU_A_CS = 1;
        IMU_B_CS = 1;

        IMU_A_RST = 0;
        IMU_B_RST = 0;

        GPS_RST = 0;

        delay_ms(1);

        IMU_A_RST = 1;
        IMU_B_RST = 1;

        GPS_RST = 1;

        delay_ms(1);

        //---------------------------------------------------------
        //lsl : 31 Dec 2010 : 1046hrs: Initialise variables : begin

        g_us_rx0_ptr = 0;
        g_us_tx0_ptr = 0;
        g_us_rd0_ptr = 0;

        for (l_us_temp = 0 ; l_us_temp < RX_BUFFER_SIZE ; l_us_temp++)
        {
                g_c_rx0_buffer[l_us_temp] = 0;
        }

        g_us_rx1_ptr = 0;
        g_us_tx1_ptr = 0;
        g_us_rd1_ptr = 0;

        for (l_us_temp = 0 ; l_us_temp < RX_BUFFER_SIZE ; l_us_temp++)
        {
                g_c_rx1_buffer[l_us_temp] = 0;
        }

        //lsl : 05 Jan 2011 : 1916hrs : tested
        UART1_Buffer = "\rlog version\r\n";
        g_us_tx1_cmd_length = 14;

        //lsl : 06 Jan 2011 : 1916hrs : tested ok
        //UART1_Buffer = "frequencyout enable 2 4\r\n";
        //g_us_tx1_cmd_length = 25;

        g_uc_gps_init = 0;

        //Enable global interrupts
        EA = 1;

        //-----------------------------------------------------------------------------
        // Start of WHILE LOOP
        //-----------------------------------------------------------------------------

   while (1)
        {
                //Toggle LED_1 & LED_2
           SFRPAGE = CONFIG_PAGE;
                LED_1 ^= 1;
                LED_2 ^= 1;

                           }

        //-----------------------------------------------------------------------------
        // End Of WHILE LOOP
        //-----------------------------------------------------------------------------
}

I could not able to transmit the data through the UART when i run the program. But when i put a breakpoint, it seems working fine. May i know where is the problem? i seems like i could not find it. thanks