Searching \ for '[PIC]:PCLATH and page switching - ICD' 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/devprogs.htm?key=icd
Search entire site for: 'PCLATH and page switching - ICD'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:PCLATH and page switching - ICD'
2001\03\21@093331 by Hardware Engineering

picon face
Bob Ammerman <spam_OUTRAMMERMANTakeThisOuTspamPRODIGY.NET> wrote:
If you value your time at all: run to buy an ICD!


OK...I agree, just need to see if the boss does too...I'm supposed to be smart
enuf to not need it!

Reading over the specs, it targets the chips I am using (how lucky am I for
that?), so the question begs to be asked...if my target assembly has the
16F874, can I not build my own ICD?  I thought someone had done this, since it
simply interfaces to MPLAB.

Of course its probably not that simple is it? It never is...

But I have to go back...why isnt this working?  I did a call to a display
routine in page 2, set the bits...didnt do ANY calls or goto's in the called
routine yet it won't work.  Come on...this should be simple right? Of course
once I get the ICD it will be obvious no doubt.

____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\03\21@111852 by Dan Michaels

flavicon
face
At 07:33 AM 3/21/01 MST, you wrote:

>Reading over the specs, it targets the chips I am using (how lucky am I for
>that?), so the question begs to be asked...if my target assembly has the
>16F874, can I not build my own ICD?  I thought someone had done this, since it
>simply interfaces to MPLAB.
>

Dear "Hardware Engineer" [whoever the h*ck you really are],

About 1 year ago exactly, there was a truly heroically-proportioned
stampede on piclist as someone discovered how to make a "Free ICD".
Made the stampede to napster look dull. So try checking back then
in the piclist archives for more info.
===============


>
>But I have to go back...why isnt this working?  I did a call to a display
>routine in page 2, set the bits...didnt do ANY calls or goto's in the called
>routine yet it won't work.  Come on...this should be simple right? Of course
>once I get the ICD it will be obvious no doubt.
>

The way I access higher code pages from page 0 is to set PCLATH
bits 3 and 4 as appropriate, immediately perform a call to the page,
once in the page execute and call code that resides "only" in that
page, use a standard < return > when I want to go back to the original
page, and then "immediately" set PCLATH bits 3 and 4 back to their
original values. In short, normal bookkeeping requires that I do
"no" manipulation of PCLATH in the called page.

OTOH, for more complicated code, once in the higher page, I do
call routines in other pages using exactly the same protocol.
Adjust PCLATH bits in the "calling" page and then re-adjust them
on return. I only ever use calls [no goto's] and the PCLATH bits
are always treated in a symmetrical fashion, no matter what.

I am sure this would work with goto's, but I try to stay away
from generating spaghetti code where possible - ie, it's probably
more difficult to keep things straight across pages when using
goto's.

- dan michaels
http://www.oricomtech.com
===================

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\03\21@114242 by David P. Harris

picon face
Hi-
So, does this mean that you explicitly segment you code using absolute addresses in
the code?  If, you expand a routine and extend off the page, do you have to
manually resegment the code?  (if so, yuck)
David

Dan Michaels wrote:

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\03\21@144919 by mike

flavicon
face
On Wed, 21 Mar 2001 07:33:39 MST, you wrote:

>Bob Ammerman <RAMMERMANspamspam_OUTPRODIGY.NET> wrote:
>If you value your time at all: run to buy an ICD!
>
>
>OK...I agree, just need to see if the boss does too...I'm supposed to be smart
>enuf to not need it!
If you're smart enough not to need an ICD, you shouldn't be working
for someone who doesn't think a $99 investement is worthwhile!
>Reading over the specs, it targets the chips I am using (how lucky am I for
>that?), so the question begs to be asked...if my target assembly has the
>16F874, can I not build my own ICD?  I thought someone had done this, since it
>simply interfaces to MPLAB.
Yes
>Of course its probably not that simple is it? It never is...
>
>But I have to go back...why isnt this working?  I did a call to a display
>routine in page 2, set the bits...didnt do ANY calls or goto's in the called
>routine yet it won't work.  Come on...this should be simple right? Of course
>once I get the ICD it will be obvious no doubt.
Remember that the bits are page preselect, not select. They determine
where the upper address bits come from on call and gotos only. Return addresses are pushed with the full address, but the bits are
NOT restored to PCLATH on return. e.g. From page 0 <SET PAGE 1>
CALL PAGE1CODE
<SET PAGE 0> ; if this is omitted, the next call or goto will go to
page 1, probably into the weeds.

PAGE1CODE
 RETURN.  

What I usually do is this, which avoids having to remember which page
each routine is in. for routines called more than once it is fairly
code-efficient.  

Page 0 : call routine1
call routine2



errorlevel -306 ; suppress warnings so we only see 'real' ones
routine1
<set page 1>
goto p1routine1

routine2
<set page 1>
goto p1routine2
errorlevel +306 ; re-enable warnings to see unintentional cross-page

------------------------PAGE 1
p1routine1
<code>
goto page1exit

p1routine2
<code>
goto page1exit

page1exit <set page 0>
return


--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2001\03\21@164727 by Dan Michaels

flavicon
face
David Harris wrote:
>Hi-
>So, does this mean that you explicitly segment you code using absolute
addresses in
>the code?  If, you expand a routine and extend off the page, do you have to
>manually resegment the code?  (if so, yuck)


Hi David, I was describing how I "specifically" handle page switching
in assembler, in order that PC transfers execute correctly. The directions
that I gave are what I found to work, although it is not quite the same
as what Mchp "seems" to describe in their datasheets.

Other people use macros for page switching, and this issue has been
regurgitated umpteen on piclist. I have no idea how various compilers
do it.

I don't use absolute addresses, but rather 4 ORG statements, at 0000h,
0800h, 1000h, and 1800h. Specific code goes into each. The assembler
keeps you from running past the end of a 2k page.

- dan michaels
http://www.oricomtech.com
===================


>Dan Michaels wrote:
>
>> At 07:33 AM 3/21/01 MST, you wrote:
>>
>> >Reading over the specs, it targets the chips I am using (how lucky am I for
>> >that?), so the question begs to be asked...if my target assembly has the
>> >16F874, can I not build my own ICD?  I thought someone had done this,
since it
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


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