gpsFix (Functionblock) |
Top Previous Next |
The gpsFix function block is used to query the current position, time, and detailed satellite information from the internal GPS module.
Note regarding decimal minutes: The value returned in decimal minutes, both latdecmin and londecmin, are assumed to be 4 digits large. This means that the position 55 Deg. 51.3 Min. North is returned as latdeg=55 latmin=51 and latdecmin=3000, and the position 55 Deg. 52.0076 North is returned as latdeg=55 latmin=52 latdecmin=76.
SBAS Support: Please see gpsSetSBAS. When the "mode" parameter that is returned from gpsFix is 4, it indicates that the fix is not only a 3D fix but has also been SBAS-corrected.
Note regarding GPS with more than 12 channels: While the full number of channels are used in position resolution, only the first 12 are included in the function block.
Note regarding HDOP, VDOP and PDOP: The DOP values should be as low as possible. They describe the geometry of the satellites used. Generally a DOP value should not be higher than 6 as that will affect the accuracy negative. Normally a DOP value will be between 2 and 3 when you have clear skies. In a city with houses screening the sky, the DOP value will be higher and accuracy will be affected. One method to increase the accuracy of the used GPS positions is not to use fixes with an HDOP value higher than, for example, 300.
All values returned by gpsFix() are in the WGS-84 datum.
Input: None.
Output: mode : SINT; 0 = No info available (GPS not powered on?). 1 = Fix unavailable. 2 = 2D position fix. 3 = 3D position fix. 4 = 3D position fix with SBAS-correction (this requires that SBAS has been enabled, see gpsSetSBAS). 5 = Dead Reckoning fix.
linsec : DINT Linsec for the timestamp received from the GPS receiver. This is the same as the separate year, month, day, minute, and second but expressed as a linsec. Also see clockLinsecToTime().
year : INT Year (absolute).
month : SINT Month (1..12).
day : SINT Date (1..31).
hour : SINT Hour (0..23).
minute : SINT Minute (0..59).
second : SINT Second (0..59).
millisecond : INT Millisecond (0..999). Only available in firmware release 3.14 or newer.
latitude : DINT Latitude expressed in a DINT. Negative is south (ddmm.mmmm (multiplied by 10000)).
latsouth : BOOL Direction of latitude (TRUE is south, FALSE is north).
latdeg : SINT Latitude degress (0..90).
latmin : SINT Latitude minutes (0..59).
latdecmin : INT Latitude decimal minutes (0..9999). This value is assumed to be 4 digits with the leading zeros removed. Please see the note regarding decimal minutes above.
longitude : DINT Longitude expressed in a DINT. Negative is west (dddmm.mmmm (multiplied by 10000)).
lonwest : BOOL Direction of longitude (TRUE is west, FALSE is east).
londeg : INT Longitude degress (0..180).
lonmin : SINT Longitude minutes (0..59).
londecmin : INT Longitude decimal minutes (0..9999). This value is assumed to be 4 digits with the leading zeros removed. Please see note regarding decimal minutes above.
speed : DINT Speed over ground in meters/hour.
course : DINT Course over ground. In xxx.xx degrees (multiplied by 100) (0=north, 90=east, 225=southwest).
height : INT Height in meters over mean sea level.
PDOP : INT Position dilution of precision (multiplied by 100).
HDOP : INT Horizontal dilution of precision (multiplied by 100).
VDOP : INT Vertical dilution of precision (multiplied by 100).
inview : SINT Number of satellites in view. This is the number of satellites that are above the horizon. If gpsPowerLP is used, this will be 0.
used : SINT Number of satellites used for the solution.
SVID[n] : SINT Satellite ID.
El[n] : SINT Elevation angle for satellite n.
Az[n] : INT Azimuth angle for satellite n.
SNR[n] : SINT Signal to noise ratio for satellite n. Max value is 55.
Declaration: FUNCTION_BLOCK gpsFix;
Example: INCLUDE rtcu.inc |