Array and ASCII


Closed Thread
Results 1 to 19 of 19

Thread: Array and ASCII

Hybrid View

  1. #1
    Join Date
    Sep 2011
    Posts
    20

    Default Array and ASCII

    Hi Need some help please.

    The problem....I have an OSD and it won't dipslay without a GPS data sentence. So thought no big deal I will creat my own, which I have done. The display does work now, but I want to use CMS10 (compass) to provide some heading information. I can not get the OSD to display the heading information even though I have filled the GPS sentance array with the data. I know it works with ASCII charaters ....so "a" would be displayed is placed in an array location. I have tried using # modifier, adding 48 to the heading result.....nothing seems to work...help! below is an extract of the code....part of one of the arrays the bold letters are the bit I am struggling with, and the main body is below (there is more to the code but stripped it out to get this bit working).



    RMC_array[39]=Dec_lat2 Dig 1+"0"
    RMC_array[40]=Dec_lat2 Dig 0+"0"
    RMC_array[41]=","
    RMC_array[42]="W"
    RMC_array[43]=","
    RMC_array[44]=Dec_off Dig 1+"0"
    RMC_array[45]=Dec_off Dig 0+"0"
    RMC_array[46]="."
    RMC_array[47]=Dec_off Dig 0+"0"
    RMC_array[48]=","
    RMC_array[49]= Heading
    RMC_array[50]="."
    RMC_array[51]=Course Dig 0+"0"
    RMC_array[52]=","
    RMC_array[53]=date_stamp Dig 1+"0"
    RMC_array[54]=date_stamp Dig 0+"0"
    RMC_array[55]=","
    RMC_array[56]=variation Dig 1+"0"
    Main
    I2CREAD DPIN,CPIN,$C0,$C1,[B2] ' Read 2 locations in a row
    B0=B2*14
    Heading=B0/10

    cksum=0
    p=0
    for p = 1 to 60
    cksum = cksum^(RMC_array[p])
    Next P
    Serout2 bob, baud, [Str RMC_array\60, HEX Cksum,13,10]
    p=0
    cksum1=0
    for p = 1 to 63
    cksum1 = cksum1^(GGA_array[p])
    Next P
    Serout2 bob, baud, [Str GGA_array\60, HEX Cksum1,13,10]
    'Serout2 bob, baud, [Str Text_array\6,13,10]
    Goto Main
    End

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    For starters, The array is sized for bytes, that will only contain a value between 0 and 255 in binary as 1 byte.
    So, the value of RMC_array[49]= Heading will only contain the value of heading between 0 and 255 as 1 byte.
    Dave Purola,
    N8NTA
    EN82fn

  3. #3
    Join Date
    Sep 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Thanks for the reply. I have set the variable as a word. But also tried creating new array elements

    WPT_array[47]=Dec_off Dig 0+"0"
    WPT_array[48]=","
    WPT_array[49]= course1 +"0"
    WPT_array[50]= course2 +"0"
    WPT_array[51]= course3 +"0"
    WPT_array[52]="."


    and then did this

    C1temp = heading dig 0
    C2Temp = heading dig 1
    C3Temp = heading dig 2
    course1 = C1Temp+48
    course2 = C2Temp+48
    course3 = C3Temp+48

    But nothing seems to work...

  4. #4
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Just a shot in the dark, but have you tried to send the data the exact same way you send the course information?

  5. #5
    Join Date
    Sep 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Yep tried that....the OSD only seems to respond to stuff if it is in inverted commas.....am I missing something here? ASCII is transmitted as data.....the inverted commas are only there to tell the complier it is to be sent in ASCII format. That is why I tried putting the # modifier infront of the variable.

  6. #6
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Can you give an example of what string of data the OSD expects to see? Is there a datasheet to reference?

  7. #7
    Join Date
    Sep 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    There is very little in terms of documentation (remzibi 3DR)....but there is a GPS simulator (happykillmore.com) incorporated into the config software which generates standard NMEA GPS sentences, for example

    $GPGGA,000000,4124.8963,N,08151.6838,W,1,05,1.5,28 0.2,M,-34.0,M,,,*59
    $GPRMC,000000,A,4916.45,N,12311.12,W,000.5,253.7,1 91194,020.3,E*68

  8. #8
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Quote Originally Posted by Seahound1 View Post
    There is very little in terms of documentation (remzibi 3DR)....but there is a GPS simulator (happykillmore.com) incorporated into the config software which generates standard NMEA GPS sentences, for example

    $GPGGA,000000,4124.8963,N,08151.6838,W,1,05,1.5,28 0.2,M,-34.0,M,,,*59
    $GPRMC,000000,A,4916.45,N,12311.12,W,000.5,253.7,191194,020.3,E*68
    Looking it over quickly, this is the value you are looking for, and likely what the remzibi 3DR calls "heading". (It would actually be true course if provided by a GPS). The important issue is the format. It looks like a string 5 characters long is required.

    So let's say you have a WORD variable MyHeading that contains a value between 0-359. To output this as it appears in the NMEA sentence use:
    SEROUT bob, baud, [DEC3 MyHeading , ".0"]

    You can see I added the decimal point and zero to fill out the five characters.

    HTH

  9. #9
    Join Date
    Sep 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Yes you are right.....sorry I maybe didn't make it very clear. The protocol for the OSD is that it must see the other characters in the array (as per below) for it even to respond. According to the firmware notes is must see the preample ($GPRMC for example) from this I guess it gets how many commas to expect so that it knows it has the whole NMEA sentence. That is why I was forced to use the array in the first place. For example I just tried SEROUT2 ("$GPRMC, 00000, etc, etc,")..... is says it has a GPS connection but then stops. Using the array it confirms GPS connection and then goes on to dispay the OSD. So I thought I could fool it into showing the heading using the two methods below....but OH NO...Is there a way to send the first part of an array and then the remainder......if I could that at least I could try using the normal method you mention below.

  10. #10
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    How about this:

    RMC_array[48]=","
    RMC_array[49]= Heading DIG 2 + "0"
    RMC_array[50]= Heading DIG 1 + "0"
    RMC_array[51]= Heading DIG 0 + "0"
    RMC_array[52]= "."
    RMC_array[53]= "0"
    RMC_array[54]=","

  11. #11
    Join Date
    Sep 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Array and ASCII

    Let me give it a whirl and see.....

    Just tried it and it doesn't work...but great idea though...thanks
    Last edited by Seahound1; - 25th May 2012 at 19:45.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts