PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Devices
Sensor
GPS
PAM-7Q GPS Test.c
1
/*
2
PAM-7Q GPS Test.c
3
4
Test PAM-7Q GPS module by detecting and displaying GPS fix status, latitude
5
and longitude measurements.
6
7
VDD -- 3.3V
8
TXD -> P11
9
RXD <- P10
10
GND -- GND
11
12
http://learn.parallax.com/propeller-c-simple-devices/
13
*/
14
15
#include "
simpletools.h
"
// Include libraries
16
#include "
gps.h
"
17
18
#define GPS_TXD 11 // GPS TX -> P11
19
#define GPS_RXD 10 // GPS RX <- P10
20
#define GPS_BAUD 9600 // Baud rate = 9600 bps
21
22
float
latitude, longitude;
// Latitude/longitude variables
23
int
fix;
// GPS fix indicator variable
24
25
int
main
()
// Main function
26
{
27
gps_open
(GPS_TXD, GPS_RXD, GPS_BAUD);
// Open the GPS driver
28
29
while
(1)
// Main loop
30
{
31
latitude =
gps_latitude
();
// Get latitude
32
longitude =
gps_longitude
();
// Get longitude
33
fix =
gps_fixValid
();
// Check for valid fix
34
35
print
(
"%c"
,
HOME
);
// Send cursor to top-left HOME
36
37
print
(
"GPS Fix: "
);
// Display fix status
38
if
(fix)
39
print
(
"Valid \n"
);
40
else
41
print
(
"Not Valid \n"
);
42
43
print
(
"\nLatitude Longitude\n"
);
// Display latitude/longitude
44
print
(
"%f %f"
, latitude, longitude);
45
46
pause
(500);
// Repeat in 1/2 second
47
}
48
}
49
HOME
#define HOME
HOME character (1) sends SimpleIDE Terminal's cursor to top-left "home" position.
Definition:
simpletools.h:233
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
gps_open
int gps_open(int gpsSin, int gpsSout, int gps_baud)
Starts the GPS NMEA parser process. This process ultimately consumes two cogs - one cog to continuous...
Definition:
gps_open.c:21
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
gps_fixValid
int gps_fixValid()
Provides the caller with a way to determine if the GPS module has a valid lock.
Definition:
gps_fixValid.c:14
gps_longitude
float gps_longitude()
Provides the caller with the current longitude in decimal degrees.
Definition:
gps_longitude.c:14
gps_latitude
float gps_latitude()
Provides the caller with the current latitude in decimal degrees.
Definition:
gps_latitude.c:14
gps.h
This library provides basic NMEA parsing capabilities. It is designed to take raw NMEA strings,...
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17