Код:
LDI ZL, LOW (NMEA_COMPLETE_STRING); loading NMEA sentence header
LDI ZH, HIGH (NMEA_COMPLETE_STRING)
LD R16, Z+; $ symbol
LD R17, Z+; G symbol
LD R18, Z+; P symbol
LD R19, Z+; ? symbol
LD R20, Z+; ? symbol
LD R21, Z+; ? symbol
STS NMEA_HEADER_C1, R19
STS NMEA_HEADER_C2, R20
STS NMEA_HEADER_C3, R21
LDS R19, NMEA_HEADER_C1; processing RMC sentence
LDS R20, NMEA_HEADER_C2
LDS R21, NMEA_HEADER_C3
CPI R19, 'R'
BRNE _not_RMC_sentence
CPI R20, 'M'
BRNE _not_RMC_sentence
CPI R21, 'C'
BRNE _not_RMC_sentence
LDI R16, 3
RCALL NMEA_parse_latitude
LDI R16, 5
RCALL NMEA_parse_longtitude
LDI R16, 8
RCALL NMEA_parse_heading
_not_RMC_sentence:
LDS R19, NMEA_HEADER_C1; processing VTG sentence
LDS R20, NMEA_HEADER_C2
LDS R21, NMEA_HEADER_C3
CPI R19, 'V'
BRNE _not_VTG_sentence
CPI R20, 'T'
BRNE _not_VTG_sentence
CPI R21, 'G'
BRNE _not_VTG_sentence
LDI R16, 1
RCALL NMEA_parse_heading
LDI R16, 7
RCALL NMEA_parse_speed
_not_VTG_sentence:
LDS R19, NMEA_HEADER_C1; processing GGA sentence
LDS R20, NMEA_HEADER_C2
LDS R21, NMEA_HEADER_C3
CPI R19, 'G'
BRNE _not_GGA_sentence
CPI R20, 'G'
BRNE _not_GGA_sentence
CPI R21, 'A'
BRNE _not_GGA_sentence
LDI R16, 2
RCALL NMEA_parse_latitude
LDI R16, 4
RCALL NMEA_parse_longtitude
RCALL NMEA_clear_parse_error
LDI R16, 7
RCALL NMEA_parse_integer_number
LDS R20, NMEA_PARSE_ERROR
SBRS R20, 0
STS NUM_SATELLITES, R16
_not_GGA_sentence:
LDS R19, NMEA_HEADER_C1; processing GSA sentence
LDS R20, NMEA_HEADER_C2
LDS R21, NMEA_HEADER_C3
CPI R19, 'G'
BRNE _not_GSA_sentence
CPI R20, 'S'
BRNE _not_GSA_sentence
CPI R21, 'A'
BRNE _not_GSA_sentence
RCALL NMEA_clear_parse_error
LDI R16, 2
RCALL NMEA_parse_integer_number
LDS R20, NMEA_PARSE_ERROR
SBRS R20, 0
STS TMP_FIXMODE, R17
_not_GSA_sentence:
LDS R19, NMEA_HEADER_C1; processing GLL sentence
LDS R20, NMEA_HEADER_C2
LDS R21, NMEA_HEADER_C3
CPI R19, 'G'
BRNE _not_GLL_sentence
CPI R20, 'L'
BRNE _not_GLL_sentence
CPI R21, 'L'
BRNE _not_GLL_sentence
LDI R16, 1
RCALL NMEA_parse_latitude
LDI R16, 3
RCALL NMEA_parse_longtitude
_not_GLL_sentence: