Searching \ for '[PIC] skpz, skpnz, etc: What are these?' 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: 'skpz, skpnz, etc: What are these?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] skpz, skpnz, etc: What are these?'
2005\05\24@165952 by Marcel van Lieshout

flavicon
face
Probably a noob question, but anyway...

I'm trying to find some official info on things like skpz and skpnz. These don't show in the instructionsets in the datasheets, not in an include-file. Searching on http://www.microchip.com for eg. skpnz didn't bring anything usefull either. I expect these to be some kind of macro, but where are they defined and documented? Where can I find a complete list?

Thanks!

Marcel

2005\05\24@171804 by Dave Turner

picon face
Did a goole for "PIC skynz".  Came up with some code - looks like it
skips the next instruction if the result of the last instruction was
zero, i.e.

loop: decf number
skpnz
goto loop

Not sure if that's right, but it's probably something like that.
Might be a macro for btfss STATUS,Z - I also saw an instruction called
skpc, which probably coresponds to btfss STATUS,C.  It's probably a
macro, because in most cases I've seen, the instruction set never
inplements something that could be done a harder, more complicated or
longer way.  ;-).  Try it out:

movlw d'255'
addlw 1
skpz
bsf porta,1
bsf porta,0

If it is what I think it is, then porta,0 should go high. (255+1 rolls
over to 0).


On 5/24/05, Marcel van Lieshout <spam_OUTmarcelTakeThisOuTspamhmcs.nl> wrote:
> Probably a noob question, but anyway...
>
> I'm trying to find some official info on things like skpz and skpnz. These don't show in the instructionsets in the datasheets, not in an include-file. Searching on http://www.microchip.com for eg. skpnz didn't bring anything usefull either. I expect these to be some kind of macro, but where are they defined and documented? Where can I find a complete list?
>
> Thanks!
>
> Marcel
> -

2005\05\24@172019 by Bob J

picon face
On 5/24/05, Marcel van Lieshout <.....marcelKILLspamspam@spam@hmcs.nl> wrote:

> I'm trying to find some official info on things like skpz and skpnz.

They're called pseudo-instructions.

Page 248, MPASM Assembler, MPLINK Object Linker, MPLIB Object
Librarian User's Guide has a listing of those instructions and their
equivalent operations.

Regards,
Bob

2005\05\24@172340 by Jan-Erik Soderholm

face picon face
Marcel van Lieshout wrote :

> Probably a noob question, but anyway...

I've no idea what that is, but you're probably right... :-)

> I'm trying to find some official info on things like skpz and
> skpnz. These don't show in the instructionsets in the
> datasheets, not in an include-file. Searching on
> http://www.microchip.com for eg. skpnz didn't bring anything usefull
> either. I expect these to be some kind of macro, but where
> are they defined and documented? Where can I find a complete list?

And you never thought of looking in the MANUAL !!??

"MPASM and MPLINK User's Guide",  DS33014H.

Jan-Erik.



2005\05\24@172341 by John J. McDonough

flavicon
face
They are called "extended instructions" and are assembled as multiple
instructions like a macro.  The onlyplace I've seen them documented is on
the quick reference card, which Microchip seems to have well hidden away.

--McD

{Original Message removed}

2005\05\24@172859 by Jan-Erik Soderholm

face picon face
Dave Turner wrote :

> Not sure if that's right, but it's probably something like that.
> Might be a macro for btfss STATUS,Z...

What about simply reading the manual ?
No, probably too easy and no fun... :-)

Jan-Erik.



2005\05\24@173009 by Michael Rathbun

flavicon
face
On Tue, 24 May 2005 22:59:42 +0200, "Marcel van Lieshout" <marcelspamKILLspamHMCS.NL>
wrote:

>Probably a noob question, but anyway...
>
>I'm trying to find some official info on things like skpz and skpnz. These don't show in the instructionsets in the datasheets, not in an include-file. Searching on http://www.microchip.com for eg. skpnz didn't bring anything usefull either. I expect these to be some kind of macro, but where are they defined and documented? Where can I find a complete list?
>
>Thanks!
>
>Marcel

DS33014H Page 248   "Appendix A-5:  12/14-bit Pseudo-instructions"

mdr (carefully refraining from including the string begining with "RTF")

2005\05\24@173648 by Marcel van Lieshout

flavicon
face
@ Jan-Erik Soderholm:
   http://en.wikipedia.org/wiki/Nub
   I don't use mplab or it's manual. That's why I looked for an answer on
the Microchip website. I downloaded the manual, thanks!

@ All other repliers:
   Thanks!

Marcel

2005\05\24@174241 by Jinx

face picon face
> "MPASM and MPLINK User's Guide",  DS33014H.

Also under Help within MPLAB eg in v6.40

Help/Topics/MPASM Assembler

Note that they are nominally available for 12- and 14-bit. To use
them with 16-bit, you need to write the macro yourself eg

skpz     macro
        btfss   zero   ; = btfss status,2
        endm

2005\05\24@174911 by Jan-Erik Soderholm

face picon face
Marcel van Lieshout wrote :

> @ Jan-Erik Soderholm:
> I don't use mplab or it's manual.

Fine with me, I didn't point to *that* manual anyway.

Jan-Erik.



2005\05\24@232226 by William Jacobs

flavicon
face
It is a skip on zero.  It is documented on page 248 of the assembler manual
ww1.microchip.com/downloads/en/DeviceDoc/MPASM_&_MPLINK_33014h.pdf
bill


Marcel van Lieshout wrote:

>Probably a noob question, but anyway...
>
>I'm trying to find some official info on things like skpz and skpnz. These don't show in the instructionsets in the datasheets, not in an include-file. Searching on http://www.microchip.com for eg. skpnz didn't bring anything usefull either. I expect these to be some kind of macro, but where are they defined and documented? Where can I find a complete list?
>
>Thanks!
>
>Marcel
>  
>

2005\05\25@040711 by Alan B. Pearce

face picon face
>I don't use mplab or it's manual. That's why I looked for an
>answer on the Microchip website. I downloaded the manual, thanks!

Well, if you do not use MPLAB, you may still like to use Olin's macros which
have a nicer set of macros for these operations than the MPLAB ones IMHO.
They have better mnemonics for the operations that they implement than the
MPLAB ones. See http://www.embedinc.com/pic/ for the download.

2005\05\25@085452 by Mike Hord

picon face
> It is a skip on zero.  It is documented on page 248 of the assembler manual
> ww1.microchip.com/downloads/en/DeviceDoc/MPASM_&_MPLINK_33014h.pdf
> bill

> >Probably a noob question, but anyway...

Something no one has mentioned, but probably should, considering
that someone who didn't know the answer to this question may not
know the fact I'm going to bring up, is:

You can't (can't can't can't)(mustn't) use these pseudoinstructions
as follows:

btfss   BOB, thumb
skpz   RALPH
....

Intuitively, it looks like if BOB has 'thumb' set, we shouldn't check
to see if RALPH is zero or not.  In practice, when you assemble this
code, MPASM (or whatever assembler you're using) is going to
expand that skpz macro to its constituent code, and you'll be left
skipping only the first instruction of that macro.  I don't know if
the assembler will gripe about that or not, but do take note of it!

Sequential skpz/skpnz pseudoinstructions have the same limitation.
I've heard people say that they don't use pseudoinstructions to avoid
this kind of pitfall (i.e., getting caught in the "why won't my code
work" trap, when it LOOKS fine).

Mike H.

2005\05\25@093418 by Wouter van Ooijen

face picon face
> You can't (can't can't can't)(mustn't) use these pseudoinstructions
> as follows:
>
> btfss   BOB, thumb
> skpz   RALPH
> ....

AFAIK skpz is a one-instruction 'macro' (that does not take any
parameters), so I see no problem in using it. I do share your objection
to multiple-instruction macro's that look like instructions.

Challenge (intermediate): write a JUMP <LABEL> macro for the 14-bit core
PICs that jumps to the target address. The macro must handle code
paging, hence it will in general expand to more than one instruction.
When preceded by a skip instruction (for instance btfss or skpz) the
JUMP macro must behave as a naive user would expect: the jump must not
be taken, execution must proceed with the instruction after the JUMP.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu


2005\05\25@102704 by andrew kelley

picon face
> Challenge (intermediate): write a JUMP <LABEL> macro for the 14-bit core
> PICs that jumps to the target address. The macro must handle code
> paging, hence it will in general expand to more than one instruction.
> When preceded by a skip instruction (for instance btfss or skpz) the
> JUMP macro must behave as a naive user would expect: the jump must not
> be taken, execution must proceed with the instruction after the JUMP.

jump        macro        address
       local        eoj
       goto        $+1
       goto        eoj


       ;jump code here, with paging.

eoj
       endm

--
andrew kelley

2005\05\25@103806 by Michael Rigby-Jones

picon face


{Quote hidden}

Something like this would work I suppose.

JUMP macro addr
   LOCAL startjump
   LOCAL endjump
   goto  startjump
   goto  endjump
startjump:
   movlw HIGH addr
   movwf PCLATH
   goto  addr
endjump:
       endm

It would be neater if you could conditionaly add the two gotos depending
on if the previous instruction was a "skip" instruction.  I'm not an
MPASM guru so I don't know if that can be done?

Regards

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

2005\05\25@105119 by Jan-Erik Soderholm

face picon face
Mike Hord wrote :

> Something no one has mentioned, but probably should, considering
> that someone who didn't know the answer to this question may not
> know the fact I'm going to bring up, is:
>
> You can't (can't can't can't)(mustn't) use these pseudoinstructions
> as follows:
>
> btfss   BOB, thumb
> skpz   RALPH
> ....
>
> Intuitively, it looks like if BOB has 'thumb' set, we shouldn't check
> to see if RALPH is zero or not.  In practice, when you assemble this
> code, MPASM (or whatever assembler you're using) is going to
> expand that skpz macro to its constituent code, and you'll be left
> skipping only the first instruction of that macro.

Now, since the SKPZ (and SKPNZ b.t.w) macro only expands to *one*
instruction there is no problem.

Bad example. Read the manual. Some other "pseudo-intructions"
does have this limitation, just as most other multiple-instruction
macros (you can take care of it inside the macro).

> I've heard people say that they don't use pseudoinstructions to avoid
> this kind of pitfall (i.e., getting caught in the "why won't my code
> work" trap, when it LOOKS fine).

Good point.

Jan-Erik.



2005\05\25@110421 by Ian Chapman

flavicon
picon face
Wouter van Ooijen <wouterspamspam_OUTvoti.nl> wrote:
>Challenge (intermediate): write a JUMP <LABEL> macro for the 14-bit core
>PICs that jumps to the target address. The macro must handle code
>paging, hence it will in general expand to more than one instruction.
>When preceded by a skip instruction (for instance btfss or skpz) the
>JUMP macro must behave as a naive user would expect: the jump must not
>be taken, execution must proceed with the instruction after the JUMP.

I'd suggest something like this:

JUMP   MACRO    Target
      LOCAL    DoJump, NoJump

      goto     DoJump
      goto     NoJump
DoJump      
      PAGESEL  Target
      goto     Target
NoJump

      ENDM

It's a bit ugly, though.  The macro consumes 3-5 program words (*) each
time it is invoked, and the execution time is 4-6 cycles (*) if the jump
is taken and 3 cycles if it is skipped (excluding the skip instruction).

(*) depending on the number of the code pages in the device

Any better offers?
--
Ian Chapman
Chapmip Technology, UK

2005\05\25@111401 by Chris Emerson

flavicon
face
On Wed, May 25, 2005 at 04:03:50PM +0100, Ian Chapman wrote:
> Wouter van Ooijen <@spam@wouterKILLspamspamvoti.nl> wrote:
> >Challenge (intermediate): write a JUMP <LABEL> macro for the 14-bit core
> >PICs that jumps to the target address. The macro must handle code
> >paging, hence it will in general expand to more than one instruction.
> >When preceded by a skip instruction (for instance btfss or skpz) the
> >JUMP macro must behave as a naive user would expect: the jump must not
> >be taken, execution must proceed with the instruction after the JUMP.
>
> I'd suggest something like this:
[...]
> It's a bit ugly, though.  The macro consumes 3-5 program words (*) each
> time it is invoked, and the execution time is 4-6 cycles (*) if the jump
> is taken and 3 cycles if it is skipped (excluding the skip instruction).
>
> (*) depending on the number of the code pages in the device
>
> Any better offers?

It's not quite following the rules, but how about:

nojump        MACRO        target
       LOCAL        skipped
       GOTO        skipped
       PAGESEL target
       GOTO        target
skipped:

Then you have to reverse the skip condition, but you lose one extra
goto.

Chris

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