Searching \ for '[PIC]: bsf + variable' 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/microchip/devices.htm?key=pic
Search entire site for: 'bsf + variable'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: bsf + variable'
2001\10\21@095707 by 1?Q?Benjamin_Menk=FCc?=

flavicon
face
I have a variable like

var equ 0x7C

movlw 0x03
movwf var
bsf PORTB,var

when i look at the disassembled code in my debugger and how the pic acts, I see that it always puts 0x04 where var is instead of 0x03.

Does anybody know why?

regards,

BEN


--------------------------
Benjamin Menküc
Auto-Intern GmbH
Haberlandstr. 125
44359 Dortmund
Tel: 0231-1893070
Fax: 0231-93699548
http://www.auto-intern.com


Meinen PGP-Schlüssel kann man unter:

http://www.auto-intern.com/php/pgp_menkuec.php

finden.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\10\21@101702 by Spehro Pefhany

picon face
At 03:49 PM 10/21/01 +0200, you wrote:
>I have a variable like
>
>var equ 0x7C
>
>movlw 0x03
>movwf var
>bsf PORTB,var
>
>when i look at the disassembled code in my debugger and how the pic acts,
I see that it always puts 0x04 where var is instead of 0x03.
>
>Does anybody know why?

The PIC instruction set requires that in bsf x, y that both x and y are
constants;
variable arguments are not allowed.

I assume what is happening is that the bsf instruction is taking (var &
0x07), which
gives you (0x7C & 0x07) = 0x04.

Best regards,
Spehro Pefhany --"it's the network..."            "The Journey is the reward"
spam_OUTspeffTakeThisOuTspaminterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
     /.-.\
    (( * ))
     \\ //     Please help if you can:
      \\\      dailynews.yahoo.com/fc/US/Emergency_Information/
     //\\\
    /// \\\
    \/   \/

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\10\21@115223 by Bob Barr

picon face
Benjamin Menk|c wrote:
>
>I have a variable like
>
>var equ 0x7C
>
>movlw 0x03
>movwf var
>bsf PORTB,var
>
>when i look at the disassembled code in my debugger and how the pic acts, I
>see that it always puts 0x04 where var is instead of 0x03.
>
>Does anybody know why?
>

If you are using MPLAB, you should have gotten several warning messages when
you assembled this code.

When I assembled it for 16f84, I got the following warnings:

Warning[219] C:\PROGRA~1\MPLAB\ASM_TEST.ASM 14 : Invalid RAM location
specified.

Message[302] C:\PROGRA~1\MPLAB\ASM_TEST.ASM 14 : Register in operand not in
bank 0.  Ensure that bank bits are correct.

Warning[202] C:\PROGRA~1\MPLAB\ASM_TEST.ASM 15 : Argument out of range.
Least significant bits used.



Did you ignore these warnings or did they not appear when you assembled your
code? The clues are there: Check the syntax for 'bsf' in the datasheet. The
destination and bit number must both be constants and in the appropriate
range.


Regards, Bob

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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