Thread: Urgent help needed

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    1

    Urgent help needed

    {0xA0,0xA2,0x00,0x02,0x8F,0x01,0x00,0x90,0xB0,0xB3 ,'/0'};
    HI Friends,
    I want to read this whole string but i am unable to receive it is receiving just 0xao and 0xa2....here is the logic
    void writeStringToGPS(unsigned char *data) {
    int i = 0, j=0;
    //putchUART2(data);
    for(i = 0; ; i++){
    writeCharToGPS(data[i]);
    if(data[i] == '\0')
    break;
    DELAY_MS(10);
    Nop();
    Nop();
    Nop();
    //i++;
    }

    j = 0;

    }..i think the problem might be with 3 char 0x00..i think it is taking as null and coming out of loop...plz help how to print all values .....

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    Change the loop so that you count 10 characters. Don't check for 0 as a terminator because the data contains that.
    for (i = 0; i < 10; i++)

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    111
    And PLEASE use the [code]-tags when posting code. It looks goddamn awful when posting code as normal text.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by cnewbie1 View Post
    It looks goddamn awful
    Can we watch the language please...

    (I'm surprised the word filters didn't catch that one....)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Urgent Help Needed In Writing Algorithm!!
    By Vikramnb in forum C++ Programming
    Replies: 1
    Last Post: 01-09-2009, 12:46 PM
  2. urgent help needed!!!
    By yosef_yaniv in forum C++ Programming
    Replies: 5
    Last Post: 12-08-2007, 12:36 PM
  3. urgent help needed
    By Leeman_s in forum Windows Programming
    Replies: 1
    Last Post: 11-11-2002, 04:27 PM
  4. Help Needed: Borland C++ 5.5 Installation - URGENT!
    By Linette in forum C++ Programming
    Replies: 12
    Last Post: 03-09-2002, 06:44 PM