Hi,
I connected Garmin GPS18x LVC (https://static.garmincdn.com/pumac/GPS_18x_Tech_Specs.pdf) yellow line, Measurement Pulse Output, directly to digital pin 2 on Arduino UNO as interrupt and then count the interrupt. I’m expecting for a pulse interrupt from Garmin GPS every 1 second.
I got very confused measurement,
const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
void setup() {
Serial.begin(115200);
Serial.println("Initializing...");
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
int cnt = 0;
void blink() {
state = !state;
if(cnt %1000 == 0) {
unsigned long cur_time = micros();
unsigned long cur_ms = millis();
Serial.print(cur_time);
Serial.print(',');
Serial.print(cur_ms);
Serial.print("ms,");
Serial.println(cnt);
}
cnt++;
}
From console output, I got cnt value of 1000 in 3015ms, about 3.015ms * 2 = 6.03ms per interrupt. According to the GARMIN document, Measurement Pulse Output shall be updated every second.
I used a scope to check pin 2 signal, it’s 0~5.5V and interval is 16.8ms…
I’m completely lost here. Would anyone help?
thanks,
Steve