BigusDickus:
Ahhh! - you're saying I can set different sentences to have different frequencies - I didn't realize this, - I will play with this concept and see what I can do.
Here's a little sketch that allows you to send configuration packets to a GPS via Arduino.
The reference at http://api.ning.com/files/L30xp1HTxtEUhhmBj4yYWIB31IDKs*xJNecJYvcEKZofuHJcZ3wnTMuZL5FeJC535I6DJbBZZE7FpJwnQPxgT9yKLCibZaZj/NMEA_Packet_Userl.pdf is quite good. This code allows you to easily send a config sentence, without you having to generate the checksum. You just type in a packet from $ to *, inclusive.
For the frequency of individual packet types, check out $PMTK314.
This code runs on an Arduino Mega2650, but you can run it on an Uno by using Software Serial (or preferably, NewSoftwareSerial) library.
One of these days, if I get time and feel ambitious, I want to write a PC program that will have a good GUI, and allow setting configuration easily.
/*
Enter a packet starting with $PMTK, and ending with a *
In this sketch the * indicates the end of transmission.
The sketch takes the packet, adds a checksum and sends it to
the GPS.
Note: If you change the baud rate of the GPS, you will have to
close the Serial monitor, change the baud rate in Serial1
(or whatever Serial port you use) and restart it.
Set your Serial Monitor to No Line Endings. The sketch supplies those too,
and if you send them, they will get you out of sync.
This sketch assumes you are running an Arduino Mega2560, and
have a serial GPS on Serial1. Change this to suit your own
configuration. (Software Serial for Uno, etc.)
One packet type not mentioned in the document at
http://api.ning.com/files/L30xp1HTxtEUhhmBj4yYWIB31IDKs*xJNecJYvcEKZofuHJcZ3wnTMuZL5FeJC535I6DJbBZZE7FpJwnQPxgT9yKLCibZaZj/NMEA_Packet_Userl.pdf
is packet type 220. Here are a couple of samples, as you
would enter them into the Serial Monitor
$PMTK220,200*
$PMTK220,500*
$PMTK220,1000*
$PMTK220,2000*
These will set the reporting interval to 200, 500, 1000,
and 2000 milliseconds, or 5, 2, 1, .5 Hz, respectively.
*/
char sentence[80];
int idx = 0;
void setup() {
// initialize both serial ports:
Serial.begin(57600);
Serial1.begin(9600);
}
void loop() {
// read from Serial1, send to Serial:
if (Serial1.available()) {
Serial.write(Serial1.read());
}
if (Serial.available()) {
char inbyte = Serial.read();
sentence[idx++] = inbyte;
sentence[idx] = 0;
if (inbyte == '*') {
for (int i=0; i < strlen(sentence); i++) {
Serial.print(sentence[i]);
}
Serial.println();
sendConfig ();
sentence[0] = 0;
idx = 0;
}
}
}
void sendConfig () {
unsigned char CS = 0;
for (int i=1; i< strlen(sentence)-1; i++) {
CS ^= sentence[i];
}
Serial1.print(sentence);
if (CS < 10) Serial1.print("0");
Serial1.print(CS,HEX);
Serial1.println();
}