Searching \ for '[PIC]: 12C509 Call Limitation' 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/devices.htm?key=pic
Search entire site for: '12C509 Call Limitation'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 12C509 Call Limitation'
2001\05\22@100153 by ael E Maj ACC/XPPI

flavicon
face
Hello all -

I've recently began tackling the 12C509 and quickly discovered the
limitation of using a Call outside of the first 256 "bytes" of each 512
page.  I've looked around and found information on related workarounds
centered on the 16CXX line using the PCLATH register, which the 12CXXX does
not have.  Can someone point me in the right direction?

Thanks
Mike Evans

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\05\22@101918 by Roman Black

flavicon
face
Evans Michael E Maj ACC/XPPI wrote:
>
> Hello all -
>
> I've recently began tackling the 12C509 and quickly discovered the
> limitation of using a Call outside of the first 256 "bytes" of each 512
> page.  I've looked around and found information on related workarounds
> centered on the 16CXX line using the PCLATH register, which the 12CXXX does
> not have.  Can someone point me in the right direction?


Hi Mike, the hardware will only call the first 256 words
as it leaves PC bit 8 cleared. I don't know of any way
of getting around this hardware fact.

The best solution is to call the function which is on
the first block (it has to be there), then simply with
one program word just goto the second 256 block where
the actual "guts" of the function is. The return will
work fine.

Messy but lets you use the whole memory for fucntions.
:o)
-Roman

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\05\22@105208 by ael E Maj ACC/XPPI

flavicon
face
Thanks Roman -
I'll play with the hardware later..but this is how I understand it...All
calls and returns must be placed in the 1st 256 "bytes" of the 512 code
space but a return may be in the upper 256 because the PC will map back to
page 1 (1st 256).  i.e.
__________________
page 1  (1st 256)
...
call xyz
...
xyz     goto    xyz_code

page 1  (2nd 256)
xyz_code
..
..
       return
__________________

Mike        _\\|//_
          (` o-o ')
____________O-(_)-O______________


________.oooO_____Oooo.__________
       (   )     (   )
        \ (       ) /
         \_)     (_/

{Original Message removed}

2001\05\22@110140 by Roman Black

flavicon
face
Actually the returns are fine. The chips have a full
functional 12-bit hardware stack. Although only 2
levels of course.

So as long as the START ADDRESS of the function
you call is on block 0, the end address of the
function (and any gotos it has) can be anywhere
within the first 512 page.

Page 19 of the datasheet shows it pretty clearly,
the only problem is the CALL which always has bit 8
clear. Returns are faithful.
:o)
-Roman



Evans Michael E Maj ACC/XPPI wrote:
>
> Thanks Roman -
> I'll play with the hardware later..but this is how I understand it...All
> calls and returns must be placed in the 1st 256 "bytes" of the 512 code
> space but a return may be in the upper 256 because the PC will map back to
> page 1 (1st 256).  i.e.

>
> {Original Message removed}

2001\05\22@111353 by ael E Maj ACC/XPPI

flavicon
face
Got it...not too messy.  Thanks again -- Mike
_____________
Roman Black Wrote:

Actually the returns are fine. The chips have a full
functional 12-bit hardware stack. Although only 2
levels of course.

So as long as the START ADDRESS of the function
you call is on block 0, the end address of the
function (and any gotos it has) can be anywhere
within the first 512 page.

Page 19 of the datasheet shows it pretty clearly,
the only problem is the CALL which always has bit 8
clear. Returns are faithful.
:o)
-Roman


Evans Michael E Maj ACC/XPPI wrote:
{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\05\22@150650 by Olin Lathrop

face picon face
> I've recently began tackling the 12C509 and quickly discovered the
> limitation of using a Call outside of the first 256 "bytes" of each 512
> page.  I've looked around and found information on related workarounds
> centered on the 16CXX line using the PCLATH register, which the 12CXXX
does
> not have.  Can someone point me in the right direction?

Not without know what you are trying to accomplish.  Are you asking how to
convert the code to a 16Cxx or how to deal with the 12C509 limitation?


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\05\22@152733 by ael E Maj ACC/XPPI
flavicon
face
I'm looking to handle the 12CXXX call limitation...I believe (Roman Black)
has pointed me in the right direction.  I've attached the tread below your
response.  Any other approach is welcome.  Thanks  --  Mike

{Original Message removed}

2001\05\23@154227 by Peter L. Peres

picon face
The short answer is that you make subroutine stubs that GOTO somewhere
else where the subroutine body is located (including higher in that page
beyond 0x100). The limitation is on CALL not on RETLW so it's ok to RETLW
from there. For example:

Subr1:
       ; some code here
       retlw   0

becomes:

Subr1:
       goto    Subr1_h

;... more code here
       org     0x110   ; f.ex.
Subr1_h:
       ; ... code here
       retlw   0

You may have to operate the paging bits (PCLATH) and save them first
before going 'high'.

I just did something like this so it was fresh ;-)

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\23@190033 by Tony Nixon

flavicon
picon face
"Peter L. Peres" wrote:

> You may have to operate the paging bits (PCLATH) and save them first
> before going 'high'.
>
> I just did something like this so it was fresh ;-)

No PCLATH in the 509. Use STATUS,PA0

I only know that offhand because I was just playing with it. ;-)

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
.....salesKILLspamspam@spam@bubblesoftonline.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\24@144853 by Peter L. Peres

picon face
Tony Nixon wrote:
> No PCLATH in the 509. Use STATUS,PA0

Right, that's what I meant ;-)

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\05\24@193758 by Alexandre Domingos F. Souza

flavicon
face
>Not without know what you are trying to accomplish.  Are you asking how to
>convert the code to a 16Cxx or how to deal with the 12C509 limitation?

       I'd love to see a "howto" convert 16F84 to 12C508/9 guide. Telling all the pros and cons, and the pitfalls

       Call me lazy, but sometimes I'm a complete dumb :o)

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\05\24@214518 by Douglas Wood

picon face
If you're talking about code translation between the two processors, my PIC
Microcontroller Instruction Set Comparison Matrix (at epicis.piclist.com)
can help. It won't help you will differences between the two chip's
peripherial sets, but it will show what instructions are available (by core
type) and the status flags affected by each instruction.

Douglas Wood
Software Engineer
dbwoodspamKILLspamkc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com

{Original Message removed}

2001\05\24@220226 by Alexandre Domingos F. Souza

flavicon
face
>If you're talking about code translation between the two processors, my PIC
>Microcontroller Instruction Set Comparison Matrix (at epicis.piclist.com)
>can help. It won't help you will differences between the two chip's
>peripherial sets, but it will show what instructions are available (by core
>type) and the status flags affected by each instruction.

       Of course it can, and helps a lot, I'm reformating it to be PDF-able in only one sheet...

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\05\24@221056 by Douglas Wood

picon face
I'm working on updating it to include more information. Also, there will
links from each instruction to an expanded page for each instruction...

Douglas Wood
Software Engineer
.....dbwoodKILLspamspam.....kc.rr.com

Home of the EPICIS Development System for the PIC and SX
http://epicis.piclist.com

{Original Message removed}

2001\05\25@011156 by Dwayne Reid

flavicon
face
At 08:43 PM 5/24/01 -0300, Alexandre Domingos F. Souza wrote:
> >Not without know what you are trying to accomplish.  Are you asking how to
> >convert the code to a 16Cxx or how to deal with the 12C509 limitation?
>
>         I'd love to see a "howto" convert 16F84 to 12C508/9 guide.
> Telling all the pros and cons, and the pitfalls

Check out "Quozl's 16F84 to 12C509 Porting Checklist" at
http://quozl.netrek.org/porting-16f84-12c509/

Hope this helps.

dwayne



Dwayne Reid   <EraseMEdwaynerspam_OUTspamTakeThisOuTplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 17 years of Engineering Innovation (1984 - 2001)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

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


2001\05\25@051746 by Roman Black

flavicon
face
Alexandre Domingos F. Souza wrote:
>
> >Not without know what you are trying to accomplish.  Are you asking how to
> >convert the code to a 16Cxx or how to deal with the 12C509 limitation?
>
>         I'd love to see a "howto" convert 16F84 to 12C508/9 guide. Telling all the pros and cons, and the pitfalls


Hi Alexandre, I have been using a suggestion that
someone here gave me a couple of months ago.

Don't think "convert" think about making the code
from the start that works with both PICs. This lets you
develop the project on the easy F84 then just change
the "development mode" in MPLAB and re-compile and
it is ready for the other PIC.

Here are a few bits from my code:


;==============================================================================
; processor defined...
       ; NOTE!! all I have to do is change the processor type in
       ; MPLAB/option/development mode/, and it is all automatic now.
       ; I do not have to edit this file at all to change processor type.

       IFDEF __16C505
               include <p16C505.inc>
       ELSE     ; for 16F84A
               include <p16F84A.inc>           ; which version to compile
       ENDIF
;==============================================================================
       ;ERRORLEVEL -224                ; suppress annoying message because of option/tris
       ;ERRORLEVEL -302                ; suppress message because of bank select in setup
ports

       LIST b=5, n=97, t=ON, st=OFF            ;
       ; absolute listing tabs=5, lines=97, trim long lines=ON, symbol
table=OFF

       IFDEF __16C505
               __CONFIG   _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC_RB4EN
       ELSE     ; for 16F84A
               __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
       ENDIF


;==============================================================================
; Variables here
       ;-------------------------------------------------
       IFDEF __16C505
               #define RAM_START       0x08
               #define RAM_END         RAM_START+23    ; is the last reg
       ELSE     ; for 16F84A
               #define RAM_START       0x0C
               #define RAM_END         RAM_START+67    ; is the last reg
       ENDIF

       ;-------------------------------------------------

       CBLOCK  RAM_START
               temp                            ; for use by any function
               latch                   ; used for my bit flags

               delay_hi                        ; for general delay loops
               delay_lo                        ;

               flash_count             ; dec, each fake int (30.5Hz)
               flash_bit_count         ; to sequence which bit to flash
               flash_data              ; the byte to flash on the led
                                               ; these 3 are only used at startup.

               ;--------------------
               timer_hi                        ; main timer (hi byte of timer0)

       ENDC
       ;-------------------------------------------------

;==============================================================================
; defines and stuff here

;------------------------------
; specific pin stuff

       IFDEF __16C505
               #define INPUT           PORTC,0 ; the input pin
               #define OUTPUT          PORTB,5 ; the output pin
               #define LED                     PORTB,4 ; the led pin
       ELSE            ; 16F84
               #define INPUT           PORTA,1 ; the input pin
               #define OUTPUT          PORTA,0 ; the output pin
               #define LED                     PORTA,3 ; the led pin
       ENDIF

;------------------------------
; custom instructions here

#define skpwne                  skpnz                   ; after subxx, uses zero
#define skpweq                  skpz                            ; after subxx, uses zero
#define skpwle                  skpc                            ; after subxx, uses carry
#define skpwgt                  skpnc                   ; after subxx, uses carry


;==============================================================================


;******************************************************************************
;  SETUP   runs this only once, must be run before entering main
;******************************************************************************
; NOTE!! we do reg initialising and also startup stuff like read dipsw

;------------------
setup                                   ; goto tag
;------------------


       ;-------------------------------------------------
                                               ; set up OPTION
       IFDEF __16C505
       ;-------------------------
       movlw b'10000011'               ;
               ;  x-------             ; 7, 1=dis, wake up on pin change
               ;  -x------             ; 6, 0=en, portb weak pullups
               ;  --x-----             ; 5, timer0 source, 0=internal clock
               ;  ---x----             ; 4, timer0 ext edge, 1=\
               ;  ----x---             ; 3, prescaler assign, 1=wdt, 0=timer0
               ;  -----x--             ; 2,1,0,  prescaler rate select
               ;  ------x-             ;  011=16 timer0
               ;  -------x             ;
       option                          ; load data into OPTION_REG
       ;-------------------------
       ELSE                                    ; 16F84
       ;-------------------------
       movlw b'00000011'               ;
               ;  x-------             ; 7, 0=en, portb pullups
               ;  -x------             ; 6, 1=/, int edge select bit
               ;  --x-----             ; 5, timer0 source, 0=internal clock
               ;  ---x----             ; 4, timer0 ext edge, 1=\
               ;  ----x---             ; 3, prescaler assign, 1=wdt, 0=timer0
               ;  -----x--             ; 2,1,0,  prescaler rate select
               ;  ------x-             ;  011=16 timer0
               ;  -------x             ;
       banksel OPTION_REG              ; go reg bank 1
       movwf OPTION_REG                ; load data into OPTION_REG
       banksel 0                               ; back to normal bank 0
       ;-------------------------
       ENDIF
       ;-------------------------------------------------
       ; other setup code here

       ;-------------------------------------------------
       goto main_after_setup           ; return to main
;******************************************************************************


Hope that helps. Remember to not use SUBLW or ADDLW,
obviously no interrupts, and try to keep most things
sequential so you can use gotos instead of calls.
:o)
-Roman

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


2001\05\25@224246 by Alexandre Domingos F. Souza

flavicon
face
>Hi Alexandre, I have been using a suggestion that
>someone here gave me a couple of months ago.
>Don't think "convert" think about making the code
>from the start that works with both PICs. This lets you
>develop the project on the easy F84 then just change
>the "development mode" in MPLAB and re-compile and
>it is ready for the other PIC.

       Hi Roman, always helpful :o) The problem is that I NEVER SEEN A PIC 12C508 :o) I had neither a clue of how different it was from 16F84. When I get my JWs, I'll play with them to learn, and so I think I'll be able to use the "dual mode" code hehehe

       BTW, The timer project is completed in the 16F84. Now it's just a time of converting it to 12C508. It's working right now here on the protoboard :o) Nice birthday gift, hehehe :oD

--
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...