Searching \ for 'Still no solution to the problem in the following' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'Still no solution to the problem in the following'.

No exact or substring matches. trying for part
PICList Thread
'Still no solution to the problem in the following '
1999\10\15@193643 by Mathew Cohen

part 0 16 bytes

1999\10\15@214928 by Mike Cornelius

part 0 15899 bytes
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>

<BODY bgColor=#ffffff>
<DIV><SPAN class=800174401-16101999><FONT color=#0000ff face=Arial size=2>Just
had quick look. Aren't you going to run out of stack ? (that certainly causes a
<DIV><SPAN class=800174401-16101999><FONT color=#0000ff face=Arial
<DIV><SPAN class=800174401-16101999><FONT color=#0000ff face=Arial
size=2>Haven't checked through the whole thing but this jumps out at me
<DIV><SPAN class=800174401-16101999><FONT color=#0000ff face=Arial
<P>Chase<BR>&nbsp; Goto Inttmr&nbsp; ; Initialise timer<BR>&nbsp; BTFSS
PORTB,7<BR>&nbsp; CALL Loop<BR>&nbsp; BTFSS INTCON,2 ; If timer has overflowed
than skip next<BR>&nbsp; CALL Chase<SPAN class=800174401-16101999><FONT
color=#000000 face=Arial size=3>
GOTO Step</P>
<P><SPAN class=800174401-16101999><FONT color=#000000 face=Arial
Internet:<BR>Byte This
Phone:&nbsp;&nbsp;&nbsp; +61 2 9310-2157<BR>PO Box 1342 Strawberry
Hills&nbsp;&nbsp;&nbsp; FAX:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +61 2
9319-3948<BR>NSW 2012
URL:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href=""
style="BORDER-LEFT: #0000ff solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">
   <DIV class=OutlookMessageHeader><FONT face="Times New Roman"
   size=2>{Original Message removed}

1999\10\16@001957 by Ben Stragnell


Is this error actually an error, or just a warning?

It's been a while since I used MPLAB, but I seem to recall it throwing
up a warning whenever you access a register in bank 1. The only reason
you're not getting a warning on the InitPortX functions is that you're
referring to TRISA and TRISB as PORTA and PORTB.

Also, as someone else pointed out, you're using call and goto in a
slightly unusual manner.


{Quote hidden}

1999\10\16@040207 by Russell McMahon

picon face
Haven't followed this thread BUT your calls from within a subroutine to the
same subroutine are re-entrant and will rapidly run off the end of the
subroutine return stack. Perhaps this is scrambling MPLABS brain.

   CALL Loop

will add a return address every time the "call loop" is executed.
A goto would be in order.

     Russell McMahon

>From another world -

What can one man* do?
Help the hungry at no cost to yourself!

(* - or woman, child or internet enabled intelligent entity :-))

{Original Message removed}

1999\10\16@090737 by paulb

Hello Mathew.

 I've had my nap.  Not long enough but...

> Thankyou to the people who who have given suggestions and help for the
> following code, but no body has solved the problem of the " not in
> bank 0 " error that it generates.

> What is this line all about?
> movwf TRISA ^ 0x080

 The assembler, as I said, has no idea of which bank it is in.  While
as a matter of "form", PORTA is seen as address $05 and TRISA as $85,
the assembler only sees the first seven bits and whinges if bit 8 is set
as you have seen.

 One way of stopping it whinging is to continue to use the correct
address, TRISA, but to hide it from the assembler by knocking off the
eighth bit, either by AND-ing it with $7F or "flipping" the eighth bit
by XOR-ing it with $80, and that is exactly what the above line does.
"TRISA ^ 0x080" is a compound expression that evaluates to an address of

> Thanks for the advice I used the TRIS command as you suggested it gave
> me a error saying that is suggests not using it??? Just another one of
> those things I guess.

 "Use the ERRORLEVEL, Luke!"  You should put " ERRORLEVEL -224" into
your P16F84.INC file.

 This warning is so insane it is beyond description.  The instruction
works, it will *always* work, it has *no* bugs, it is the fastest and
thus *preferred* way to set the (A and B only) TRIS registers in the
vast majority of cases, it is independent of bank switching, and it is
incorporated in the *latest* processors as well.

 ERRORLEVEL -305 appears to be useful for something also.

> Also the code does not work when burn to a pic.  When simulated it
> works fine until it hit a loop.  Then MPLAB starts "dinging" me
> (making an error sound) I am not sure what thats for I think it is to
> do with the loop being endless.

 I think that was the stack overflow someone else commented on.

 Your code appeared to be badly tabbed when posted.  It should arguably
look like the following for legibility.  Double spacing is unnecessary:

{Quote hidden}

         ERRORLEVEL -224
>         __FUSES _CP_OFF & _WDT_OFF & _HS_OSC    ;Set default config
** HS oscillator?  4 MHz?  What's wrong with XT?
{Quote hidden}

 ; Useful
 MOVLF   MACRO   lit,file
         MOVLW   lit
         MOVWF   file

 ; Also useful
 MOVFF   MACRO   source,dest
         MOVF    source,W
         MOVWF   dest

> ;---------------------------------------------------------------------
> ; Program Code
> ;---------------------------------------------------------------------
**  ; Is this right?
{Quote hidden}

         MOVLF   B'00000001',step1
         MOVLF   B'00000010',step2
         MOVLF   B'00000100',step3
         MOVLF   B'00001000',step4
         CLRF    Steppos
>         CALL    InitPortA       ; Sets up porta to be outputs
>         CALL    InitPortB       ; Sets up portb to be inputs
         CALL    Inittmr         ; Initialise timer

> Loop
>         MOVF    PORTB,W         ; Read Portb into w register
>         MOVWF   PORTA           ; Move W into Porta
** Can't do a bit test on W
         BTFSC   PORTB,7         ; If bit 7 is set goto Chase
>         CALL    Chase
         GOTO    Loop
> ;---------------------------------------------------------------------
> Chase
         BTFSS   PORTB,7         ; Switch bit still set?
         RETURN                  ; If not, return
         BTFSC   INTCON,T0IF     ; If timer has overflowed
         CALL    Step            ;  then do a step
         GOTO    Chase           ;  else try again
> ;---------------------------------------------------------------------
> Step
 ; ** Sorry, your code was not repairable(!!).
         BCF     INTCON,T0IF     ; Clear the interrupt (T-ZERO-I-F)
         INCF    Steppos,F
         BTFSC   Steppos,2       ; Is it 4?
         CLRF    Steppos         ; if so, zero
         MOVF    Steppos,W
         ADDLW   step1           ; Use as index, add to *address* step1
         MOVWF   FSR
 ;       MOVF    INDF,W          ; load W with step(Steppos)
 ;       MOVWF   PORTA           ; Output Step pattern
 ; Or, more neatly:
         MOVFF   INDF,PORTA      ; output step(Steppos)
>           RETURN

> ;---------------------------------------------------------------------
> InitPortA
>         MOVLW   0               ; Clears w register
         TRIS    PORTA           ; Set port a as outputs
>         MOVWF   PORTA           ; clear outputs
>         RETURN
> ;---------------------------------------------------------------------
> InitPortB
>         MOVLW   255             ;
         TRIS    PORTB           ; Set port a as inputs
>         RETURN
> ;---------------------------------------------------------------------
> Inittmr
 ;       BCF     INTCON,INTF     ; Clears interrupt if set (but why?)
 ; Port B pullups ON, TMR0 internal, prescale 256
>         MOVLW   B'00000111'     ;
         OPTION                  ; Option reg, similar TRIS instruction
>         RETURN
>         END

 Note that since I know the Register Bank Select bit defaults to zero,
I need never alter it!
       Paul B.

1999\10\17@195747 by Tony Nixon

picon face
> Loop
>                 MOVF PORTB,w  ; Read Portb into w register
>   MOVWF PORTA  ; Move W into Porta
>   BTFSC W,7  ; If bit 7 is set goto Chase
>   CALL Chase
>   CALL Loop  <<<<<<<

I think someone mentioned that the above will cause a stack overflow.

The section below probbaly won't execute as you want.
>From within 'Loop' an instruction called Chase.

>From within 'Chase' you GOTO Inttmr.
The return at the end of Inttmr will fall back to the instruction
'call Chase'

Try 'CALL Inttmr'

{Quote hidden}

Best regards


1999\10\18@054047 by Nigel Orr

At 09:32 16/10/99 +1000, you wrote:
>solved the problem of the " not in bank 0 "  error that it generates.

If that is error 302, it's just a warning, to make you look at your code
and double check that it is right.

If you are _certain_ that you have not made any mistakes (as someone who
has been wrongly certain several times...), add

       ERRORLEVEL -302         ; Stops info error messages

at the start of your code.


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