Important: The information in this document is obsolete and should not be used for new development.
WriteLocation
You can use theWriteLocation
procedure to change the geographic location or time-zone information stored in extended parameter RAM.
PROCEDURE WriteLocation (loc: MachineLocation);
loc
- The geographic location and time-zone information to write to the extended parameter RAM.
DESCRIPTION
TheWriteLocation
procedure takes the geographic location and time-zone information, specified in theloc
parameter, and writes it to the extended parameter RAM.The latitude and longitude are stored in the geographic location record as
Fract
values, giving accuracy to within 1 foot. For example, aFract
value of 1.0 equals 90 degrees; -1.0 equals -90 degrees; and -2.0 equals -180 degrees.To store latitude and longitude values, you need to convert them first to the
Fixed
data type, then to theFract
data type. You can use the Operating System Utilities routinesLong2Fix
andFix2Fract
to accomplish this task. Listing 4-8 on page 4-19 shows a procedure that converts San Francisco's latitude and longitude toFract
values, then writes theFract
values to extended parameter RAM using theWriteLocation
procedure.The daylight savings time value is a signed byte value that you can use to specify the offset for the
hour
field--whether to add one hour, subtract one hour, or make no change at all.The Greenwich mean time value is in seconds east of GMT. For example, San Francisco is at -28,800 seconds (8 hours * 3,600 seconds per hour) east of GMT. The
gmtDelta
field is a 3-byte value contained in a long word, so you must take care to set it properly. When writinggmtDelta
, you should mask off the top byte because it is reserved. In addition, you should preserve the value ofdlsDelta
. Listing 4-10 on page 4-21 shows a procedure that writesgmtDelta
, with the top byte masked off, while preserving the value ofdlsDelta
.SPECIAL CONSIDERATIONS
AlthoughWriteLocation
does not move or purge memory, you should not call it at interrupt time.SEE ALSO
For more information on the geographic location record, see page 4-29. For more information on theFract
data type and the conversion routinesLong2Fix
,Fix2Fract
,Fract2Fix
, andFix2Long
, see the chapter "Mathematical and Logical Utilities" in this book.