Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to convert degree minutes seconds into decimal value

Status
Not open for further replies.

engineer khan

Member level 3
Joined
Aug 31, 2012
Messages
66
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,833
Hello All dears,

I m working to design a device that take location lat long, i successfully obtained lat-long but the problem is that lat-long value is in degree/minutes/seconds i need it in decimal number, let suposed i get lat=2450.1234 which in decimaol is "24.83336761111111" how can i go from first value to the latter one.....i sought on net where i found a formula degree/+minutes/60+second/3600 ,the question is that how to covert 2450.1234 to 24.83336761111111 in c coding i m using pic18f mikroc compiler
 

Code:
void LongToTime (long Ticks, char * h, char * m, char * s)
{
 while (Ticks--)
{
s++;
if (*s == 60) {*s = 0; *m++;}
if (*m == 60) {*m = 0; *h++;}
}
}
This is untested. Wrote in 10 seconds after lunch (intelligent descreased greatly).

Few minutes later...
Ticks = 60*60*h + 60*m + s;
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top