On Fri, 28 Apr 2000 PDRUNEN@AOL.COM wrote: > Date: Fri, 28 Apr 2000 14:06:21 EDT > From: PDRUNEN@AOL.COM > Reply-To: pic microcontroller discussion list > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: COMF W > > In a message dated 4/28/00 11:45:31 AM Central Daylight Time, > rleggitt@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. 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