CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

GPS coordinate to Google earth coordinate

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
eng.alamin



Joined: 08 Sep 2008
Posts: 17

View user's profile Send private message

GPS coordinate to Google earth coordinate
PostPosted: Wed Oct 08, 2008 10:57 am     Reply with quote

Hello, when I am using mplab C18 I use this method to convert latitude and longitude value from GPS coordinate to google earth coordinate:
Code:

float gpstogoogle (float gps)
{
   int degrees = (int) gps / 100;
  float minutes = gps - 100 * degrees;

  return (degrees + minutes / 60.0);
}


But this method is not working in CCS.

Anyway this is the theory:

ddmm.mm [gps] = dd + mm.mm/60 [google earth]

How it can be done in CCS ?

Thanks
eng.alamin



Joined: 08 Sep 2008
Posts: 17

View user's profile Send private message

PostPosted: Wed Oct 08, 2008 12:02 pm     Reply with quote

Well I'll try to make myself clear Laughing

I have
Code:
float lat = 2514.2388 ;


I want
Code:
  x = 25 ;

Code:
   y = 14.2388 ;


I try this x = (int) lat /100
to make x = 25 ;
but it not work
help please Crying or Very sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 08, 2008 12:26 pm     Reply with quote

In CCS, an 'int' is the same size as 'unsigned char' in C18.

To translate C18 code to CCS, you need to change every instance
of 'int' to 'signed int16'.
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Wed Oct 08, 2008 1:14 pm     Reply with quote

Btw. Has someone ever collected the comprehensive set of rules (like replace every 'xxx' with 'yyy', etc.) of converting C18 code to CCS ?
If yes, could it be automated as easily as writing some macros into a text editor ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group