Searching \ for '[PIC]: LGOTO and LCALL command' 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: 'LGOTO and LCALL command'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: LGOTO and LCALL command'
2003\03\20@225800 by WH Tan

flavicon
face
Is anyone here know where can I find an explanation of LGOTO and LCALL
command.

Thanks in advance.


WH Tan

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

2003\03\21@081655 by Olin Lathrop

face picon face
> Is anyone here know where can I find an explanation of LGOTO and LCALL
> command.

Commands in what environment?  Did you mean PIC instructions?  If so,
these are probably aliases for the 18 family BRA and RCALL instructions.
They may also be someone's macros for local GOTOs and CALLs within a
module.  I have macros for these but call them JUMP and MCALL.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

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

2003\03\21@085835 by WH Tan

flavicon
face
Opp. Sorry not to mention MPLAB.

I read about memory paging of PIC16 series. I think LGOTO and LCALL are
command that concern to this issue. But I find no explanation in MPLAB
manual.

WH Tan


{Original Message removed}

2003\03\21@132605 by Dennis Crawley

flavicon
face
WH,
> I read about memory paging of PIC16 series. I think LGOTO and LCALL are
> command that concern to this issue. But I find no explanation in MPLAB
> manual.
They clear o set bit 4:3 of PCLATH register which can directly write the
upper 5 bits of the program counter. (Please, correct me if I'm wrong) This
is performed at compilation time. MPASM calculate the position of the label
you called setting up bits 4:3 automatically.

These are special instructions for 12 and 14 bit core. Care must be taken
in addresses larger than 64k.
Try to get the Data sheet 30400x.pdf and 33014x.pdf where x means version.
The quick reference guide and MPASM,MPLINK and MPLIB manual.
Also try http://www.piclist.com on PCLATH .


The list=ON switch is a very useful debugger tool in such a case.
I use it all the time.

There are more methods to SET/CLEAR bits 4:3 of PCLATH reg.
1. - Move to W the High address of the label as a literal and write it into
PCLATH reg. This can cause unwanted things in some cases.
2.- LCALL
3.- PAGESEL specially used in relocatable code
4.- Set 4:3 PCLATH bits by hand. This can optimize the code saving one
instruction. There are cases your code have to jump to 1:1 and PCLATH
already is in 0:1, so you don't need to set bit 3.

This is an example of the same routine with the four methods.
Look how methods 2,3 and 4 have the same results.
The routine call label "ESPERA" which is in page 0x0800 of a 16F877.

LOC  |OBJECT CODE VALUE  | LINE |SOURCE TEXT
-----|-------------------|------|----------------------

NO PCLATH MODIF, GO TO "WHO-KNOWS-ADDRESS"
-----|-------------------|------|----------------------
0009   2000               00020     CALL    ESPERA


(1)HIGH
-----|-------------------|------|----------------------
0007   3008               00018     MOVLW   HIGH ESPERA
0008   008A               00019     MOVWF   PCLATH
0009   2000               00020     CALL    ESPERA

(2)LCALL
-----|-------------------|------|----------------------
0007   158A 120A 2000     00020     LCALL   ESPERA


(3)PAGESEL
-----|-------------------|------|----------------------
0007   158A 120A          00019     PAGESEL ESPERA
0009   2000               00020     CALL    ESPERA

(4)BSFBCF
-----|-------------------|------|----------------------
0007   158A               00018     BSF    PCLATH,3
0008   120A               00019     BCF    PCLATH,4
0009   2000               00020     CALL   ESPERA


MEM LOC OF LABEL "ESPERA"
-----|-------------------|------|----------------------
0800   3054               00031  ESPERA: movlw  84




Dennis

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

2003\03\21@142844 by Olin Lathrop

face picon face
> These are special instructions for 12 and 14 bit core. Care must be
> taken in addresses larger than 64k.

They are certainly NOT instructions.  They may be special assembly
directives or macros.  They are also not "commands".  There is enough
confusion in this area, so please use these terms correctly.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

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

2003\03\21@155520 by Dave Wheeler

flavicon
face
Guys,

Lets not squabble.

These fall into the category of "12-Bit/14-Bit Core Special Instruction
Mnemonics" along with various others like BC (Branch on Carry)
BNC (Branch on NO Carry)

We all know that Olin's environment rocks but some of still do it the
hard way :-)

Dave
---------------snip-----------------
{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

2003\03\21@162028 by Dennis Crawley

flavicon
face
Hi, Olin.
Just what I've said, "please correct me if I'm wrong".
But, with your excuse, I don't feel totally wrong when I call "LCALL" and
"LGOTO" instructions. DS33014G.pdf page 184 and DS30400D page 7 clearly put
them among others "mnemonics" and call them 12bit/14-bit Core Special
*Instruction* Mnemonics. At least by now, I don't concur with you that they
are macros. It seems like MPASM calculate the address of k and then modify
H0A,3 and H0A,4 accordingly. They say the equivalent operation is BCF,
etc, but that doesn't make of LCALL a macro...or it does?
Is this so confusing?

Cheers,

Dennis.

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

2003\03\23@200234 by WH Tan

flavicon
face
Thank you very much to all who had reply.

I really appreciate your time, especially Dennis, for his detail
explanation.


WH Tan

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

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