Searching \ for 'Code question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=code+question
Search entire site for: 'Code question'.

Truncated match.
PICList Thread
'Code question'
1998\05\21@183144 by Dominic Gualtieri

flavicon
face
I am basically new to Pic`s  and I am having trouble understanding a
line in some code I
came across. Any help would be appreciated. Below is the code:

movlw 0D0
btfss    portc,w         --Is this line checking for a specific bit, and
if so which one?

Dominic

1998\05\21@194039 by Justin Crooks

flavicon
face
portc,w-- w is replaced with a 0 when assembled.

----------
> From: Dominic Gualtieri <spam_OUTdgualtieriTakeThisOuTspamNETWORX.ON.CA>
> To: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
> Subject: Code question
> Date: Thursday, May 21, 1998 3:59 PM
>
> I am basically new to Pic`s  and I am having trouble understanding a
> line in some code I
> came across. Any help would be appreciated. Below is the code:
>
> movlw 0D0
> btfss    portc,w         --Is this line checking for a specific bit, and
> if so which one?
>
> Dominic

1998\05\21@215849 by Andrew Warren

face
flavicon
face
Dominic Gualtieri <PICLISTspamKILLspamMITVMA.MIT.EDU> wrote:

> I am basically new to Pic`s  and I am having trouble understanding a
> line in some code I came across. Any help would be appreciated.
> Below is the code:
>
> movlw   0D0
> btfss   portc,w         --Is this line checking for a specific bit,
>                           and if so which one?

Dominic:

The author of this code was also new to PICs... Or he was going to a
lot of trouble to make his code difficult to understand.

The code assembles without errors only because of a convenient
accident:  Internally, MPASM defines "W" as equivalent to "0" so
instructions like "MOVF REG,W" will assemble correctly.

Because MPASM treats "W" as "0", the BTFSS line is assembled as
"BTFSS PORTC,0"... So it's checking bit 0 of the "PORTC" register.

I'd be real surprised if that's what the code's author intended,
though.

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam.....ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499 (personal)
=== http://www.netcom.com/~fastfwd (business)

1998\05\22@015304 by Clyde Smith-Stubbs

flavicon
face
On Thu, May 21, 1998 at 06:55:15PM -0800, Andrew Warren wrote:

> Because MPASM treats "W" as "0", the BTFSS line is assembled as
> "BTFSS PORTC,0"... So it's checking bit 0 of the "PORTC" register.
>
> I'd be real surprised if that's what the code's author intended,

I suspect that at some time the author decided that writing things
like addwf x,0 was a Bad Idea because it isn't obvious where the destination
is, so decided to do a global replace of ,0 with ,w - and caught a few
other things in the net.

Clyde

--
Clyde Smith-Stubbs               |            HI-TECH Software
Email: EraseMEclydespam_OUTspamTakeThisOuThtsoft.com          |          Phone            Fax
WWW:   http://www.htsoft.com/    | USA: (408) 490 2885  (408) 490 2885
PGP:   finger clydespamspam_OUThtsoft.com   | AUS: +61 7 3354 2411 +61 7 3354 2422
---------------------------------------------------------------------------
HI-TECH C: compiling the real world.

1998\05\22@054106 by Emil Atanassov
picon face
---Dominic Gualtieri <@spam@dgualtieriKILLspamspamNETWORX.ON.CA> wrote:
>
> I am basically new to Pic`s  and I am having trouble understanding a
> line in some code I
> came across. Any help would be appreciated. Below is the code:
>
> movlw 0D0
?
> btfss    portc,w         --Is this line checking for a specific bit,
and
> if so which one?

BTFSS f, b - Bit Test f, Skip if Set
b = 3-bit bit address
f = 7-bit file register address


>
> Dominic
>

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

1998\05\22@133925 by andre

flavicon
face
Dominic Gualtieri wrote:

> I am basically new to Pic`s  and I am having trouble understanding a
> line in some code I
> came across. Any help would be appreciated. Below is the code:
>
> movlw 0D0
>

hex value is not right it should be 0xD0 or D0H or H'D0'this line means load
hex D0 in  W register

> btfss    portc,w         --Is this line checking for a specific bit, and
>

this line is wrong but it will work becouse of w = 0same as   btfss
portc,0


you are testing bit 0 on portc it will skip if it is clear


> if so which one?
>
> Dominic


Andre

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...