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

Parents
  • After sending the command of the through the transmit untill my end of the command. i would wait for the GPS receiver to send me data through UART 1 where the receive flag anknowledge a "1". therefore i will read from the uC memory from the the UART rx buffer.

Reply
  • After sending the command of the through the transmit untill my end of the command. i would wait for the GPS receiver to send me data through UART 1 where the receive flag anknowledge a "1". therefore i will read from the uC memory from the the UART rx buffer.

Children
  • But you said, in your original post, that your problem is that nothing is sent!

  • today i did proble the transmit port from the uC and i could able to see the command send through oscillscope. At first, my guess was the transmit part got problem but i seems like not. I m totally lost about this because i not really sure where my problems lies at.

  • If you're lost when you have all the code and the hardware and all the information in front of you, how do you expect anyone else to know what's going on when we can't even see all of your code?!

    Where did the code come from? Presumably, you didn't write it yourself?
    Can you contact the original author?

    You seem to have basic problems with the operation of your buffered UART "driver".
    You really need to isolate that part and concentrate on understanding it and getting it working. The GPS unit and everything else are just unnessary distractions & complications at this point.