Searching \ for 'TRISA Setting' 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/index.htm?key=trisa+setting
Search entire site for: 'TRISA Setting'.

Truncated match.
PICList Thread
'TRISA Setting'
1998\09\02@184428 by David Sprenkle

flavicon
face
Instead of beating my head against the wall on something really, really
simple, I thought I would post my problem to the list.  What am I
forgetting to do to Tris the a and b ports.  See code and error messages
below.  This is on MPLAB 3.4.

;*******************************************************************
; Motor.ASM   Ver 1.00
;        Motor Driver
;*******************************************************************
;
;*******************************************************************
;
       LIST    p=16F84
       INCLUDE "P16F84.INC"

LeftBottomPort equ H'5'
LeftBottom equ 1

RightBottomPort equ H'5'
RightBottom equ 0

LeftTopPort equ H'5'
LeftTop  equ 3

RightTop equ 6
RightTopPort equ H'6'

MiddlePin equ 1
MiddlePinPort equ H'6'

LeftPin  equ 3
LeftPinPort equ H'6'

RightPin equ 4
RightPinPort equ H'6'


bsf STATUS, RP0

movlw b'11111111'
movwf TRISA          <<<<<<  LINE 39

movlw b'11010101'
movwf TRISB          <<<<<<<< LINE 42

MainLoop
btfss LeftTopPort, LeftTop
bcf RightPinPort, RightPin

btfsc LeftTopPort, LeftTop
bsf RightPinPort, RightPin

goto MainLoop
end


Building MOTOR.HEX...

Compiling MOTOR.ASM:
Command line: "C:\PROGRA~1\MPLAB\MPASM.EXE /aINHX8M /e+ /l+ /x+ /w0 /c+
/m+ /rhex /p16F84 /q C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM"
Message[302] C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM 39 : Register in operand
not in bank 0.  Ensure that bank bits are correct.
Message[302] C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM 42 : Register in operand
not in bank 0.  Ensure that bank bits are correct.

Build completed successfully.


David Sprenkle

1998\09\02@191526 by Dennis Plunkett

flavicon
face
At 05:41 PM 2/09/98 -0500, you wrote:
>Instead of beating my head against the wall on something really, really
>simple, I thought I would post my problem to the list.  What am I
>forgetting to do to Tris the a and b ports.  See code and error messages
>below.  This is on MPLAB 3.4.

3/9/'98

Hello David,
If you look into the Microchip data book, you will see that the TRISA and
TRISB registers are in the second register bank, thus you have to set the
upper register enable bits to get to them. The assembler is sending you a
warning indicating that this may not have been done (You have to do it). If
this becomes be annoying warning, then you can turn it off by setting the
waning level to 302, but I suggest that you don't do this.


Dennis

1998\09\02@192154 by David Sprenkle

flavicon
face
Dennis thannk you very much for responding but I know you are suppose to set
some bit to get to the second bank, could you give me the code.  I thought the
bsf STATUS, R0 was suppose to do that.  What else am I suppose to be doing.
(please include command)

Dennis Plunkett wrote:

{Quote hidden}

--

1998\09\02@194503 by Chip Weller

flavicon
face
David Sprenkle wrote:


>Instead of beating my head against the wall on something really, really
>simple, I thought I would post my problem to the list.  What am I
>forgetting to do to Tris the a and b ports.  See code and error messages
>below.  This is on MPLAB 3.4.
> <snipped>
>Message[302] C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM 39 : Register in operand
>not in bank 0.  Ensure that bank bits are correct.
>Message[302] C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM 42 : Register in operand
>not in bank 0.  Ensure that bank bits are correct.


MPASM will warn about any access to other than bank 0. It does not have the
ability to track internally the RAM bank bits set at various points in the
program. This does get very irritating and I wrote a macro package which
fixes this, generating warnings only when there is a problem, including when
accessing bank 0 when another bank is selected. Microchip should have done
this from the start, but as it requires the programmer to tell the assembler
what to assume the bank registers are set to they probably figured they
would get complaints about it not generating warnings in when the programmer
misuses it.

Chip Weller

1998\09\02@212044 by Dennis Plunkett

flavicon
face
At 06:19 PM 2/09/98 -0500, you wrote:
{Quote hidden}

Yes you are correct, set GP0 in the status register, and then use the
nominal TRISA TRISB commands (I am not quite sure if these are the commands
that Microchip don't recommend for future use, but this will just make your
problem more difficult).

The code sample provided did not set this bit, so do it, then write to the
TRIS register required and clear the GP0 bit to get back to the first
register bank.

As for the warnings, ALWAYS check them, and only dismiss them when you are
sure that they have no implications. This is a GOOD practice, this will then
get you into the habit, especially for high level language compiler warnings.

Dennis

1998\09\03@111058 by Ajmal Shami

picon face
David,

Change the line
>  movwf TRISA          <<<<<<  LINE 39
to
  movwf TRISA & 0x7F
and
>  movwf TRISB          <<<<<<<< LINE 42
to
  movwf TRISB & 0x7F

and it should be OK.

(Someone please correct me if I am wrong)
As in include file TRISA is defined as 0x85 and TRISB equ 0x86 and
since you are changing the page by the command
>  bsf STATUS, RP0
you are trying to go to bank 2, which does not exist.

Hopefully this will help.

Regards
Ajmal


---David Sprenkle <spam_OUTsprenkleTakeThisOuTspamBUSPROD.COM> wrote:
>
> Instead of beating my head against the wall on something really,
really
> simple, I thought I would post my problem to the list.  What am I
> forgetting to do to Tris the a and b ports.  See code and error
messages
{Quote hidden}

/c+
> /m+ /rhex /p16F84 /q C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM"
> Message[302] C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM 39 : Register in
operand
> not in bank 0.  Ensure that bank bits are correct.
> Message[302] C:\DAVID\MPLAB\MOTORD~1\MOTOR.ASM 42 : Register in
operand
> not in bank 0.  Ensure that bank bits are correct.
>
> Build completed successfully.
>
>
> David Sprenkle
>

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

1998\09\03@183010 by paulb

flavicon
face
David Sprenkle wrote:

> What else am I suppose to be doing?

 The most popular recommendation appears to be EOR the register values
to which you write with a compile value called (say,) BANK.

 You can either set BANK permanently to $80 and use it only for
register operations you know to be in bank 1, or set up macros called
BANK1 and BANK0 which perform the BSF/BCF STATUS,RP0 operation and also
set BANK to $80 or $00 respectively.  You can then perform all I/O
operations using the exclusive or with BANK and you will (mostly) be
warned when you have RP0 set wrong.
--
 Cheers,
       Paul B.

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