Searching \ for '[PIC]:pic16F877... driving me crazy !' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=16F
Search entire site for: 'pic16F877... driving me crazy !'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:pic16F877... driving me crazy !'
2001\05\30@222048 by Patrick J

flavicon
face
I bet its something really stupid simple-doesnt help me tho, I can see it :-/

877 with 4MHz crystal, DIP. My prg is supposed to be on page0.
All its supposed to do, is a 'hello world' by toggle portb, bit 7

When the code below is compiled I get this error msg:
"AN607.ASM 51 : Register in operand not in bank 0.  Ensure that bank bits are correct."
I have tried switching to bank0, and bank1, it doesnt help


LIST P = 16F877, F = INHX8M, n = 66

_CP_OFF  EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_XT_OSC  EQU H'3FFD'
_PWRTE_ON EQU H'3FF7'

__FUSES ( _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON )
RP1  EQU H'0006'  ; STATUS Bits
RP0  EQU H'0005'  ; STATUS Bits

STATUS  EQU H'0003'  ; PORTB  EQU H'0006'  ; (avail only when Bank=0)
TRISB  EQU H'0086'  ; (avail only when Bank=1)

;-----------------------------------------------------------------------------
;Macros to select the register bank
Bank0  MACRO   ;macro to select data RAM bank 0
 bcf STATUS,RP0
 bcf STATUS,RP1
 ENDM

Bank1  MACRO   ;macro to select data RAM bank 1
 bsf STATUS,RP0
 bcf STATUS,RP1
 ENDM
;=============================================================================
;Reset-vector code
 org 0x0000   ; POWER_ON RESET (Beginning of program PIC16F877)
 goto    START
;=============================================================================
START       org 0005H  ; the address *after* int. vector

 clrf STATUS  ; Do initialization (Bank 0)
 MOVLW  0x00  ; Define values for PortB..
 MOVWF  PORTB  ; ..before bits set to out and/or in

 Bank1   ; Switch to Bank 1
 MOVLW B'00000000' ; Set PortB pins as input=1, output=0
 MOVWF  TRISB  ; do it

 Bank0   ; Switch to Bank 0
LOOP
 BSF  PORTB, 7 ; port B, bit7:=High
 BCF  PORTB, 7 ; port B, bit7:=Low
 GOTO  LOOP
END

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\05\30@223014 by Drew Vassallo

picon face
>When the code below is compiled I get this error msg:
>"AN607.ASM 51 : Register in operand not in bank 0.  Ensure that bank bits
>are correct."
>I have tried switching to bank0, and bank1, it doesnt help

Note that it's not an error, it's a warning.  All this means is that the RAM
location you're trying to access is not in Bank 0, so you have to make sure
that you've set your page bits properly.   If you have done this, then
you're OK.  If you double-click on the error message itself in the window
that pops up when you compile, it will take you directly to the line in your
code that it's referring to.  This is handy to fix any problems that pop up.

People like to remove the appearance of this error by setting errorlevel
-302, but for beginners, I think it's probably a good idea to see what's
happening at compile-time.

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

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\05\30@223959 by Tony Nixon

flavicon
picon face
Patrick J wrote:
> When the code below is compiled I get this error msg:
> "AN607.ASM 51 : Register in operand not in bank 0.  Ensure that bank bits are correct."
> I have tried switching to bank0, and bank1, it doesnt help


There is no problem with your code. The assembler is just reminding you
that TRISB is in RAM Page 1 and make sure you have the bank bits set
properly which you have done.

Some other problems....

The LVP fuse bit will default to LVP mode so RB3 will be used for low
voltage program enable. You must set it to '0' so that RB3 becomes a
digital IO. At the moment, I gather the pin is unconnected so it will be
floating on powerup and may cause problems.

You have not set ADCON1, so all analog pins will be in analog mode. In
this simple case it doesn't matter though.

You should really set all unused pins as outputs. Even this test program
may be affected by pins that float around as unconnected inputs.

BSF BCF type instructions are not recommended on ports one after the
other. Place a NOP between them or write directly to the port.

>   BSF  PORTB, 7 ; port B, bit7:=High
>   BCF  PORTB, 7 ; port B, bit7:=Low


If you use this code line after the LIST line....

       #include "p16f877.inc"

These following lines become predefined for you as they are declared in
the above file.

{Quote hidden}

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
salesspamKILLspambubblesoftonline.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\05\30@230925 by Nick Veys

flavicon
face
That should only be a warning...

try this instead...

>   MOVWF  TRISB ^ 0x80  ; do it

that should shut MPLAB up...

and you are looking @ PB7 on an oscilliscope, right?  because it's switching
hella fast...

EraseMEnickspam_OUTspamTakeThisOuTveys.com | http://www.veys.com/nick

> {Original Message removed}

2001\05\30@231051 by Alexandre Domingos F. Souza

flavicon
face
>When the code below is compiled I get this error msg:
>"AN607.ASM 51 : Register in operand not in bank 0.  Ensure that bank bits are correct."
>I have tried switching to bank0, and bank1, it doesnt help

       Note this is a **warning** message, and by no means, an error.

       It should be hidden or better explained in mplab/mpasm. I also spent a week before discovering the code was just right - it worked out of the compiler. It was just a warning message, your code is already compiled and working ok! :oD

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2001\05\31@075707 by Olin Lathrop

face picon face
> When the code below is compiled I get this error msg:
> "AN607.ASM 51 : Register in operand not in bank 0.  Ensure
> that bank bits are correct."
> I have tried switching to bank0, and bank1, it doesnt help

Yeah, that assembler warning is really annoying - and useless.  I filter it
out.  It comes up whenever you access a known address in other than bank 0,
something you have to do regularly.  It's trying to warn you that since the
target is not in bank 0, that you need to make sure the bank bits are set
correctly.  I guess it assumes the bank bits are always left at 0 since it
doesn't warn about a target in bank 0.  Really stupid.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, @spam@olinKILLspamspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu


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