degToPosition (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function converts a coordinate from decimal degrees to GPS position format.

 

Note: This function works with DOUBLE, but can also work with FLOAT as described in the Floating-point math introductory section.

 

Input:

v : DOUBLE

Value to convert.

 

Returns: DINT

The GPS position.

 

Declaration:

FUNCTION degToPosition : DINT;
VAR_INPUT
v : DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
 
DebugMsg( message := "Pos = (" +
  dintToStr( v:= degToPosition(v := 55.85513)) + ", " +
  dintToStr( v:= degToPosition(v := 9.850883)) + ")");
 
END_PROGRAM;