Truncated match.
PICList
Thread
'COMF W'
2000\04\28@082500
by
PDRUNEN
Hi Group,
The MPLAB assembler will compile the COMF W statement but does not work on
the simulator. Since it did compile then I assume that the COMF W is doing
something, but I am not sure what it does?
Anyone provide a bit of light on this?
Paul
2000\04\28@092615
by
KŸbek Tony
Hi,
this is not do-able ( like you have written ).
COMF W will be compiled as:
COMF INDF which means the ram adress pointed at by FSR
W will be replaced by '0' by the compiler which inturn is the ramadress
for the INDF register, which uses the FSR to point to an memory location
;-)
are we having fun yet ? ( just kidding :-) )
To do an COMF on the W reg without using temp ram I belive was mentioned
on the list no so long ago ( this month ), cant really remeber the
'best' way so You better do a search to find it.
/Tony
Tony KŸbek, Flintab AB
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
E-mail: spam_OUTtony.kubekTakeThisOuT
flintab.com
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
2000\04\28@092824
by
Andy Baker
|
You must be careful not to mix register locations, and the identifiers for
where the results of an operation should be put.
COMF can only operate on a real file register, either an internal one (like
PORTB), or one of your own defined ones.
You then specify where the results should go, as either W(0) or F(1) If
omitted, there is a default destination (but i can't remember if it is W or
F, as I never use this faeture).
So normal usage would look like:
comf PORTB,W
In your case, the W is read as the register to complement. So COMF W
compliments register 0 (the value of W), which maps to register INDF (on a
16F84). The real register that INDF refers to depends on the setting of FSR.
The result is then stored in the default location.
To do what you really want to do, it is 2 instructions:
movwf TEMP
comf TEMP,W
Hope this helps,
Andy
-----Original Message-----
From: .....PDRUNENKILLspam
@spam@AOL.COM [PDRUNEN
KILLspamAOL.COM]
Sent: 28 April 2000 13:22
To: .....PICLISTKILLspam
.....MITVMA.MIT.EDU
Subject: COMF W
Hi Group,
The MPLAB assembler will compile the COMF W statement but does not work on
the simulator. Since it did compile then I assume that the COMF W is doing
something, but I am not sure what it does?
Anyone provide a bit of light on this?
Paul
2000\04\28@092827
by
Martin SchŠfer
Paul:
the directive < comf W > will assemble to < comf 0,1 >. This complements
the register file 00h, which is normally the INDF register and stores the
result back in INDF, whereever INDF is pointing to.
The W-orking register can be complemented by < xorlw 0xFF >.
martin
;**********************************************
;** name: Martin Schaefer **
;** company: elektronik 21 GmbH, Germany **
;** e-mail: EraseMEschaeferspam_OUT
TakeThisOuTelektronik21.de **
;**********************************************
2000\04\28@100358
by
M. Adam Davis
|
The W register is really one of the harder working registers in the PIC, and it
deserves a good compliment every now and then!
I say we should stop asking for so much efficiency, and put
xorlw 0xFF
xorlw 0xFF
in our main program loop so the W register knows it's doing a good job!
_
/ \ The Rouge Ribbon
\ / Campaign:
X Complement your W
/ \ register often!
Of course, a REAL programmer would be able to compliment their hardest working
register without problems: PC!
It would be really neat to have a program which would take an ASM source file
and insert COMF PC,1 randomly, rearranging the program as needed so it jumps to
the correct location after a COMF PC,1, and still have the program run correctly
(albiet a bit more slowly)
Can you imagine the look on someone's face who's just dissassembled your code?
"WHAT THE...?!?"
Now there's real code protection. Anyone who can follow that code could rewrite
it themselves.
-Adam
Martin Schdfer wrote:
{Quote hidden}>
> Paul:
>
> the directive < comf W > will assemble to < comf 0,1 >. This complements
> the register file 00h, which is normally the INDF register and stores the
> result back in INDF, whereever INDF is pointing to.
>
> The W-orking register can be complemented by < xorlw 0xFF >.
>
> martin
>
> ;**********************************************
> ;** name: Martin Schaefer **
> ;** company: elektronik 21 GmbH, Germany **
> ;** e-mail:
schaefer
spam_OUTelektronik21.de **
> ;**********************************************
2000\04\28@124149
by
rleggitt
|
Try XORLW 0xFF instead.
On Fri, 28 Apr 2000, KŸbek Tony wrote:
{Quote hidden}> Date: Fri, 28 Apr 2000 15:19:36 +0200
> From: KŸbek Tony <
@spam@tony.kubekKILLspam
FLINTAB.COM>
> Reply-To: pic microcontroller discussion list <
KILLspamPICLISTKILLspam
MITVMA.MIT.EDU>
> To:
RemoveMEPICLISTTakeThisOuT
MITVMA.MIT.EDU
> Subject: Re: COMF W
>
> Hi,
> this is not do-able ( like you have written ).
> COMF W will be compiled as:
> COMF INDF which means the ram adress pointed at by FSR
>
> W will be replaced by '0' by the compiler which inturn is the ramadress
> for the INDF register, which uses the FSR to point to an memory location
> ;-)
> are we having fun yet ? ( just kidding :-) )
>
> To do an COMF on the W reg without using temp ram I belive was mentioned
> on the list no so long ago ( this month ), cant really remeber the
> 'best' way so You better do a search to find it.
>
> /Tony
>
>
>
> Tony KŸbek, Flintab AB
> ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
> E-mail:
spamBeGonetony.kubekspamBeGone
flintab.com
> ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
>
2000\04\28@125634
by
Dmitry Kiryashov
|
Hi Paul. Ok. Step by step explanation what you are doing.
It is wrong at all but why it can be compiled successfully ?
1. W is defined in include file as 0 (see .inc file for more info)
2. comf operation takes data from register, invert it and put back
to destination, destination can be the same reg itself or W reg
In your case : COMF W
is compiled as : COMF 0
which means that pic has to take data from INDF (0) reg. Looks like destination is
omitted. By MPLAB defaults it means put data back in register ( ,F or ,1 ) if you
didn't redefined it.
So in you example processor will take value from INDF, invert it and put back to INDF.
INDF is register that for some magical reason becomes the data memory cell which
address is specified by FSR register in some strange way ;) (read your pic docs about
that)
Good luck in research ! ;)
(Better to read some real working progs, it really can help, search inside of piclist
archive for that)
WBR Dmitry.
-----
TakeThisOuTPDRUNENEraseME
spam_OUTAOL.COM wrote:
>
> Hi Group,
>
> The MPLAB assembler will compile the COMF W statement but does not work on
> the simulator. Since it did compile then I assume that the COMF W is doing
> something, but I am not sure what it does?
>
> Anyone provide a bit of light on this? Paul
2000\04\28@140828
by
PDRUNEN
In a message dated 4/28/00 11:45:31 AM Central Daylight Time,
RemoveMErleggitt
TakeThisOuTCONCENTRIC.NET writes:
<< Try XORLW 0xFF instead. >>
Thanks!!
But still, why not the COMF W, I also tried COMF W,W but that just put the
value
into w as $FF, so something else was read as $00.
2000\04\28@151317
by
rleggitt
|
On Fri, 28 Apr 2000 PDRUNENEraseME
.....AOL.COM wrote:
> Date: Fri, 28 Apr 2000 14:06:21 EDT
> From: EraseMEPDRUNEN
AOL.COM
> Reply-To: pic microcontroller discussion list <RemoveMEPICLISTEraseME
EraseMEMITVMA.MIT.EDU>
> To: RemoveMEPICLISTspam_OUT
KILLspamMITVMA.MIT.EDU
> Subject: Re: COMF W
>
> In a message dated 4/28/00 11:45:31 AM Central Daylight Time,
> RemoveMErleggittTakeThisOuT
spamCONCENTRIC.NET writes:
>
> << Try XORLW 0xFF instead. >>
>
> Thanks!!
>
> But still, why not the COMF W, I also tried COMF W,W but that just put the
> value
> into w as $FF, so something else was read as $00.
File register instructions have a destination code, 0 or 1, i.e. MOVLW
REG,0. But saying '0' or '1' is a pain, so the assembler has predefined:
#define W 0
#define F 1
The address of the INDF file register is 0, so the definition of 'INDF'
is:
#define INDF 0
The COMF instruction works with a register address, i.e. COMF 0. The
symbol you used to plug the '0' in there is irrelevant.
You could also say 'COMF C' and get the same result, because the carry bit
is bit 0 of the status register, thus:
#define C 0
Remember that symbols don't exist to the PIC, these are for your
edification only. Take a look at the listing file and you'll see the
actual opcodes being generated, you can reference back to the spec to see
what's going on. These are the only things that the micro sees (although
not in hex :). -- Rich
2000\04\28@154500
by
jamesnewton
The real issue is that the assembler (as with most) does not assign types.
It doesn't know that "IND" is a "register" or that "C" is a "statusbit" or
that "W" (and "F") is an "accumulator" or a "destination" which is not a
"register".
If it did, then the definition
COMF register
could throw an error like
COMF W
ERROR ^- COMF expects a register. W is a destination.
or
COMF W, W
ERROR ^- COMF expects a register. W is a destination.
ERROR ^- COMF expects 1 parameter.
Also, if you tried to do
ADDWF PCL, PCL
ERROR ^- ADDWF has PCL as register but needs a destination. PCL
is a register.
As Rich says, all the assembler knows is number. Every symbol gets
translated to a number first, then plugged in.
COMF W
becomes
COMF 0
which complements IND.
---
James Newton (PICList Admin #3)
EraseMEjamesnewtonspam
spamBeGonepiclist.com 1-619-652-0593
PIC/PICList FAQ: http://www.piclist.com or .org
{Original Message removed}
2000\04\28@161432
by
Andrew Warren
2000\04\28@162458
by
jamesnewton
2000\04\29@160504
by
Dwayne Reid
<x-flowed>At 08:21 AM 4/28/00 -0400, KILLspamPDRUNENspamBeGone
AOL.COM wrote:
>Hi Group,
>
>The MPLAB assembler will compile the COMF W statement but does not work on
>the simulator. Since it did compile then I assume that the COMF W is doing
>something, but I am not sure what it does?
W is not a physical register, so you can't compliment it that way. But you
can do:
comw MACRO
xorlw 0xFF
endm
and then just use 'comw' where you need it
dwayne
Dwayne Reid <EraseMEdwayner
EraseMEplanet.eon.net>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(780) 489-3199 voice (780) 487-6397 fax
Celebrating 16 years of Engineering Innovation (1984 - 2000)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.
</x-flowed>
2000\04\29@171437
by
PDRUNEN
Thanks for everyone's help!
Paul
In a message dated 4/29/00 3:05:07 PM Central Daylight Time,
@spam@dwayner@spam@
spam_OUTPLANET.EON.NET writes:
<< W is not a physical register, so you can't compliment it that way. But you
can do:
comw MACRO
xorlw 0xFF
endm
and then just use 'comw' where you need it
dwayne
>>
2000\04\30@094030
by
Harold Hallikainen
|
On Fri, 28 Apr 2000 14:06:21 EDT spamBeGonePDRUNEN
KILLspamAOL.COM writes:
> In a message dated 4/28/00 11:45:31 AM Central Daylight Time,
> .....rleggittspam_OUT
CONCENTRIC.NET writes:
>
> << Try XORLW 0xFF instead. >>
>
> Thanks!!
>
> But still, why not the COMF W, I also tried COMF W,W but that just
> put the
> value
> into w as $FF, so something else was read as $00.
Cuz W is not in the "file register" address space on most PICs. Some
(the 17c and 18c) DO put w in the file register address space, but, since
the include files have w defined as 0 (and f defined as 1) to set the
destination bit in most instructions, these include files instead use the
name WREG to hold the address of W when it IS in the file register
address map.
Harold
________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk! For your FREE software, visit:
dl.http://www.juno.com/get/tagj.
'COMF W'
2000\05\02@205450
by
Alejandro Lavarello
|
<x-flowed>Hi, folks!
What about XORLW 0x'FF' ??
It complements each bit in W....
Bye!
>Tony KŸbeck has written:
>Hi,
>this is not do-able ( like you have written ).
>COMF W will be compiled as:
>COMF INDF which means the ram adress pointed at by FSR
>W will be replaced by '0' by the compiler which inturn is the ramadress
>for the INDF register, which uses the FSR to point to an memory location
>;-)
>are we having fun yet ? ( just kidding :-) )
>To do an COMF on the W reg without using temp ram I belive was mentioned
>on the list no so long ago ( this month ), cant really remeber the
>'best' way so You better do a search to find it.
>/Tony
>
>
>Tony KŸbek, Flintab AB
>ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
>E-mail: TakeThisOuTtony.kubek.....
TakeThisOuTflintab.com
>ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
>
---------------- o ---------------------
Name: Alejandro Lavarello
ICQ: 35 764 596 alejol
e-mail: TakeThisOuTalejolKILLspam
spamadinet.com.uy
Address: Zapican 2560 apto 308
City: Montevideo
Country: Uruguay
Work title: Electronic Technician
Work organization: Intendencia Municipal de Montevideo
Work address: Palacio Municipal - Subsuelo-
Seccion Senales Luminosas
Work e-mail: .....semaforos
RemoveMEimm.gub.uy
Work tel/fax: +598 2 9011930
----------------- o --------------------
</x-flowed>
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- Today
- New search...