Searching \ for '16C74 Interrupt Routine' 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/ints.htm?key=interrupt
Search entire site for: '16C74 Interrupt Routine'.

Truncated match.
PICList Thread
'16C74 Interrupt Routine'
1998\11\02@073621 by Victor Moisey

flavicon
picon face
Greetings

I am using a 16C74 with TMR0 providing interrupts at a fixed rate. I have
to save values during the interrupt routine so I made use of the example
given in the data manual to save Status and W registers in RAM. This is
the part that is causing problems.

>From the data manual:
"Example 14-1 and Example 14-2 store and restore the STATUS and W
registers. For the PIC16C74 and PIC16c73, the register, W_TEMP, must be
defined in both banks and must be defined at the same offset from the the
bank base address (i.e., if W_TEMP is defined at 0x20 in bank0, it must
also be defined at 0xA0 in bank 1)."

My problem is that defining W_TEMP in both banks produces an error. I have
made use of the CBLOCK directive to define W_TEMP.

Should I be making use of some other way of defining W_TEMP?

TIA



Victor Moisey
Institute of Child Health
Red Cross Childrens Hospital
Private Bag
Rondebosch 7700
Cape Town
South Africa

1998\11\02@081124 by Gramatke, M.

flavicon
face
> From: Victor Moisey [spam_OUTVMOISEYTakeThisOuTspamICH.UCT.AC.ZA]

> From the data manual:
> "Example 14-1 and Example 14-2 store and restore the STATUS and W
> registers. For the PIC16C74 and PIC16c73, the register,
> W_TEMP, must be
> defined in both banks and must be defined at the same offset
> from the the
> bank base address (i.e., if W_TEMP is defined at 0x20 in
> bank0, it must
> also be defined at 0xA0 in bank 1)."

> My problem is that defining W_TEMP in both banks produces an
> error.

Put the lines

W_TEMP  equ     20
W_TEMPBk1       equ     W_TEMP+80

into your code, that's all.

The command "movwf W_TEMP" in the interrupt will now addresses 20 or a0,
depending on STATUS,RP0.
The definition of W_TEMPBk1 is just for your remembrance, that a0 is in
use.

Martin Gramatke

1998\11\02@090818 by Mike Keitz

picon face
On Mon, 2 Nov 1998 14:24:35 SAST-2 Victor Moisey <.....VMOISEYKILLspamspam@spam@ICH.UCT.AC.ZA>
writes:


>My problem is that defining W_TEMP in both banks produces an error. I
>have
>made use of the CBLOCK directive to define W_TEMP.

Something like this should work:

       cblock  h'20'
       W_TEMP          ;Stores W during interrupt
       ....   (other variables)
       endc

       cblock  h'a0'
       W_TEMP1         ;Must be same place as W_TEMP, but in bank
1.
       ....   (Other variables)


In the program, always use W_TEMP.  W_TEMP1 is defined just to save a
place for it.

A further refinement would be to have the assembler check that W_TEMP1 is
indeed offset from W_TEMP by exactly 80h and issue an error if not:

IF (W_TEMP1 != W_TEMP + h'80')
 error "Bad assignment of W_TEMP1"
ENDIF

It's been a while since I used an IF directive so this example may not be
correct.

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

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