Searching \ for 'Waking up due to an external interrupt.' 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: 'Waking up due to an external interrupt.'.

Truncated match.
PICList Thread
'Waking up due to an external interrupt.'
1998\10\10@232242 by netquake

flavicon
face
Hello!

I'm having trouble porting some hc705 code to a PIC16F84.
Original code goes to a WAIT state until external interrupt
pin 'RST (which I suppose could be replaced with RB0/'INT in
a PIC) drops (logic 0). This event puts 705 PC over the
external interrupt vector and an interrupt service routine
is executed. Now...I was trying to use SLEEP instruction for
this but I'm not sure whether a drop on RB0/'INT will wake
the PIC from sleep state. I have enabled global interrupts:

bsf     INTCON,GIE

and also RB0 as an interrupt source:

bsf     INTCON,INTE

but simulation freezes after SLEEP.
I've read that PIC external interrupt vector is 0004h but
don't know how to handle this (I'm still having trouble to understand
Harvard architecture cause I like *everything* single memory mapped.
Can I access from my code the Program memory? How?
The question becomes critical because I have to read from a fixed table
of 32 bytes and general purpose registers run low (while I have more
than plenty of Program memory space).




--------------------------------------------
"I must not fear. Fear is the mind-killer.
Fear is the little death that brings total
obliteration. I will face my fear... I will
permit it to pass over me and through me."

Kwisatz Haderach - Dune

       netQ
<spam_OUTnetquakeTakeThisOuTspaminnocent.com>

1998\10\11@010229 by James Cameron

flavicon
face
netQ wrote:
> but simulation freezes after SLEEP.

Does your simulator simulate interrupts?

> (I'm still having trouble to understand Harvard architecture cause I
> like *everything* single memory mapped.

Chuckle.  I know the feeling.  I started on Harvard only this year.

> Can I access from my code the Program memory? How?

Program another PIC to read the code by driving your PIC into
programming mode.  Only way.

> The question becomes critical because I have to read from a fixed
> table of 32 bytes and general purpose registers run low (while I
> have more than plenty of Program memory space).

There's always another way to skin a cat, as they say.

Use the "retlw" instruction to compose a set of table values, and add
the offset to the PC.  This takes just about as much space in program
memory as a table of numbers anyway, since the "retlw" instruction takes
up 14 bits regardless of the constant value.

table   addwf   pcl,f   ; jump to the w'th return statement
       retlw   45
       retlw   99
       retlw   12
       retlw   22
       ...

main    movlw   2       ; which entry we want
       call    table
       ...             ; it's in w now.

--
James Cameron                                    (.....cameronKILLspamspam@spam@stl.dec.com)
Digital Equipment Corporation (Australia) Pty. Ltd. A.C.N. 000 446 800

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