microcontroller - Accurately measuring Time for an event ( relay contact closure) using GPS PPS -


i have relay contact closure event needs timestamped accurately ( 1 msec) gps , pps output... not sure how feed relay contact output microcontroller , synchronize microcontroller clock gps ...plus how utc afterall? can please me. thanks

if microcontroller has @ least 2 interrupts based on hardware pins, connect relay 1 of interrupt-generating pins, , pps other interrupt-generating pin.

you need connect nmea (or other proprietary protocol of gps) corresponding port in microcontroller. common buses uart or sip.

then, every time pps interrupt, enable global flag can used in main loop reset counter. counter tell how far apart pps relay switched (if happens within second). if know base frequency of counter, can convert counter fractions of seconds. note if both edges of relay state change have detected, need interrupt source capable interrupt on both edges (or use 2 interrupts)

then, if relay interrupt goes off, can value of counter upon interrupt, , save in storage, send host, etc. (note, best save value in ram, lift flag of "value present", , leave sending/storing main loop, turning off flag).

finally, when receive complete nmea message (this being parsed in main loop state machine instance), can send information host or storage along counter saved time relay state change. note please nmea message generated , decoded delay pps, need compensate that.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -