> -----Original Message----- > From: Ed Sutton [SMTP:esutton@NOMADICS.COM] > Sent: Wednesday, July 30, 2003 6:12 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Newbie looking for "extended instructions" macro resources? > > I am a PIC 16F8 newbie. One of the first things I was thinking is start > building an include file containining macros for making helpful "extended > instructions". > > This must have been done a thousand times by PIC experts. Can anyone > point > me to or send me any of their favorite macros? Call accross page boundary > macros etc. I have not had much luck Googling for PIC macros. > > For example, I would like a macro to create an "extended instruction" to > replace the following two instructions: > > ;M=a > MOVLW a > MOVWF M > > ;***************************************** > ;* Macro to assign a literal to a memory location via W > ;* > ;* Note: Modifies W register > '* > ;***************************************** > MOVLWF macro l, m > MOVLW l > MOVWF M > endm > MPASM actually has several macro's built in. The following can be found in the MPASM help file under "Special instructions". HTH Mike mnemonic Description EquivalentOperation(s) Status ADDCF f,d Add Carry to File BTFSCINCF 3,0f,d Z ADDDCF f,d Add Digit Carry to File BTFSCINCF 3,1f,d Z B k Branch GOTO k - BC k Branch on Carry BTFSCGOTO 3,0k - BDC k Branch on Digit Carry BTFSCGOTO 3,1k - BNC k Branch on No Carry BTFSSGOTO 3,0k - BNDC k Branch on No Digit Carry BTFSSGOTO 3,1k - BNZ k Branch on No Zero BTFSSGOTO 3,2k - BZ k Branch on Zero BTFSCGOTO 3,2k - CLRC Clear Carry BCF 3,0 - CLRDC Clear Digit Carry BCF 3,1 - CLRZ Clear Zero BCF 3,2 - LCALL k LGOTO k MOVFW f Move File to W MOVF f,0 Z NEGF f,d Negate File COMFINCF f,1f,d Z SETC Set Carry BSF 3,0 - SETDC Set Digit Carry BSF 3,1 - SETZ Set Zero BSF 3,2 - SKPC Skip on Carry BTFSS 3,0 - SKPDC Skip on Digit Carry BTFSS 3,1 - SKPNC Skip on No Carry BTFSC 3,0 - SKPNDC Skip on No Digit Carry BTFSC 3,1 - SKPNZ Skip on Non Zero BTFSC 3,2 - SKPZ Skip on Zero BTFSS 3,2 - SUBCF f,d Subtract Carry from File BTFSCDECF 3,0f,d Z SUBDCF f,d Subtract Digit Carry from File BTFSCDECF 3,1f,d Z TSTF f Test File MOVF f,1 Z ======================================================================= 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. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu