Initialization
Initializing the GPS module
GPS module is connected to a multiplexer, due to GPRS module and 3G/GPRS module are connected to the same microcontroller UART. To start using GPS module, this multiplexer is switched on and the right combination for GPS is selected.
When the module is switched on, the OSP sentence "PSRF150,1\3E*" is received, which means the module is ready.
After the communication with the GPS is available, some initial values are used by the init()
function, to set the initial position of the GPS module. The default values of these variables are set in the constructor. The default position is set on Zaragoza (Spain) and the user can modify them to set other location.
All the necessary configuration for a right GPS initialization is done by the ON()
function.
Example of use:
Switching GPS off
It turns GPS off and closes the UART
Example of use:
Wait for signal connection
Once the GPS is set on, it is necessary to wait for signal connection. The function in charge of this duty is waitForSignal()
.
This function waits to connect to satellites for a specific time. The default time to wait for signal connection is 60 seconds. But another time can be specified. If the GPS module connects to satellites, the function returns successfully. If the GPS does not connect to satellites for the specified time, then returns error.
It returns '1' if the GPS has connected within the period of time and '0' if not.
Example of use:
Setting the GPS Power Mode
The function setMode()
sets the current internal Power Mode on the GPS. The GPS module has two different power modes: GPS_ON
and GPS_OFF
. This function is used by default inside ON() and OFF() functions.
The function will set up the pwrMode
variable to one of the two values.
Example of use:
Related variables:
GPS.pwrMode
→ stores GPS power mode
Setting the UART communication
There are a couple of functions to control the state of the microcontroller\'s UART. But it is recommended to use both ON()
and OFF()
functions to switch on/off the GPS module and open/close the microcontroller\'s UART at the same time.
Open UART
It opens the UART the GPS module is connected to.
Example of use:
Close UART
It closes the UART the GPS module is connected to. It implies the disconnection of the internal UART drivers inside the ATMEGA1281 processor.
Example of use:
Setting the communication mode
Sets the communication mode: binary or NMEA. By default, the GPS module starts using NMEA mode.
The possible values have been defined in previous chapters.
Returns '1' if success and '0' if not.
Example of use:
Related variables:
GPS.commMode
→ stores communication mode established in the GPS module
Last updated