Reply by Crane September 8, 20062006-09-08
Thanks, Fabio, that explains the problem.

Fábio Pereira wrote:
>
> The MOV.B instruction (and all byte instructions) actually erase the MSB
> byte of the destination register...
>
> Regards,
>
> Fábio
>
> ----- Original Message -----
> From: Crane
> To: m...
> Sent: Friday, September 08, 2006 8:29 AM
> Subject: [msp430] Parsing a byte string
>
>
>
> I am monitoring the NMEA stream from a GPS and need to recognize the
> $GPGLL
> header. The scheme I am trying use is to take bytes out of the UART and
> shift them up through three registers. After each new entry I test for
> the
> header pattern.
>
> The problem is that nothing gets shifted through the registers. I use
> the
> SWPB instruction elsewhere in my code and it works. Something is wrong
> with
> my shift algorithm but I can't see it. Any ideas?
>
> ;----------------------
> ; Character stream - every character recieved is entered into a shift
> ; register that consists of R5 (lo order) through R7 (hi order)
> ;----------------------
>
> Char: swpb R7 ; Shift byte 5 to the byte 6 position
> swpb R6 ; Move byte 3 to the byte 4 position
> mov.b R6, R7 ; Move byte 4 to the byte 5 position
> swpb R5 ; Move byte 1 to the byte 2 position
> mov.b R5, R6 ; Move byte 2 to the byte 3 position
> mov.b R12, R5 ; Insert new byte into position 1
> ret
> --
>
>
>
>
>
>
>
> ------
>
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.7/437 - Release Date: 4/9/2006
>
>
>
>
>
>
>
>
>
>

Beginning Microcontrollers with the MSP430

Reply by September 8, 20062006-09-08
The MOV.B instruction (and all byte instructions) actually erase the MSB byte of the destination register...

Regards,

Fio

----- Original Message -----
From: Crane
To: m...
Sent: Friday, September 08, 2006 8:29 AM
Subject: [msp430] Parsing a byte string

I am monitoring the NMEA stream from a GPS and need to recognize the $GPGLL
header. The scheme I am trying use is to take bytes out of the UART and
shift them up through three registers. After each new entry I test for the
header pattern.

The problem is that nothing gets shifted through the registers. I use the
SWPB instruction elsewhere in my code and it works. Something is wrong with
my shift algorithm but I can't see it. Any ideas?

;----------------------
; Character stream - every character recieved is entered into a shift
; register that consists of R5 (lo order) through R7 (hi order)
;----------------------

Char: swpb R7 ; Shift byte 5 to the byte 6 position
swpb R6 ; Move byte 3 to the byte 4 position
mov.b R6, R7 ; Move byte 4 to the byte 5 position
swpb R5 ; Move byte 1 to the byte 2 position
mov.b R5, R6 ; Move byte 2 to the byte 3 position
mov.b R12, R5 ; Insert new byte into position 1
ret
--



------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.7/437 - Release Date: 4/9/2006




Reply by Crane September 8, 20062006-09-08
I am monitoring the NMEA stream from a GPS and need to recognize the $GPGLL
header. The scheme I am trying use is to take bytes out of the UART and
shift them up through three registers. After each new entry I test for the
header pattern.

The problem is that nothing gets shifted through the registers. I use the
SWPB instruction elsewhere in my code and it works. Something is wrong with
my shift algorithm but I can't see it. Any ideas?

;-----
; Character stream - every character recieved is entered into a shift
; register that consists of R5 (lo order) through R7 (hi order)
;-----

Char: swpb R7 ; Shift byte 5 to the byte 6 position
swpb R6 ; Move byte 3 to the byte 4 position
mov.b R6, R7 ; Move byte 4 to the byte 5 position
swpb R5 ; Move byte 1 to the byte 2 position
mov.b R5, R6 ; Move byte 2 to the byte 3 position
mov.b R12, R5 ; Insert new byte into position 1
ret
--