Is " xorlw '$' " valid opcode for a PIC?

Status
Not open for further replies.

johankj

New Member
I saw this code for a PIC (16F88) using RS232 to receive GPS data.

All GPS data has a string identifier at the start of the sentence $, followed by for example $GPRMC.

Here is the code in question
Code:
		;Sit here waiting around until you get a valid start of a NMEA sentence	
		movfw	Rcd_Char
		xorlw	'$'				;start of sentence?

Rcd_Char I assume is the received character, which is moved to W. Then, presumably, xorlw '$' will maske W, and return zero.

WOT? Have I've been doing hours of ASCII to binary conversions all for nothing? When I could've done:
Code:
	MOVLW	'A'
	CALL	RS232_SEND
 
johankj said:
WOT? Have I've been doing hours of ASCII to binary conversions all for nothing? When I could've done:
Code:
	MOVLW	'A'
	CALL	RS232_SEND

Yes you have, perhaps you should have read the assembler instructions or helpfile?. You can declare constants as decimal, hex, binary, ASCII - and perhaps even octal? (never been interested enough to find out).
 
Nigel Goodwin said:
Yes you have, perhaps you should have read the assembler instructions or helpfile?. You can declare constants as decimal, hex, binary, ASCII - and perhaps even octal? (never been interested enough to find out).

Ouch! Ok, by declaring constants, do you mean something like?:
Code:
#DEFINE		A	B'O1100101'

	...


	MOVLW		A
	CALL		RS232_SEND
 
Ok, I just looked up the .hpl file that came with MPASM.

I seems you can use the following syntax for ASCII

A'A'

or just

'A'

So just scratch that above comment Thanks for the comment Nigel.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…