'Waking up due to an external interrupt.'
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:
and also RB0 as an interrupt source:
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
> 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
main movlw 2 ; which entry we want
... ; it's in w now.
James Cameron (stl.dec.com) cameron
Digital Equipment Corporation (Australia) Pty. Ltd. A.C.N. 000 446 800
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...