Hi Richard At 10:56 98.08.14 -0500, you wrote: >Having just finished first PIC project. A PIC 16C73 that reads a 4-wire touch screen and communicates bi-[SNIP] >And finally what macros / compiler directives do you experienced people find most helpful? > >This list is such a awesome source... and sorry for the FAQ I asked earlier. > > >-- >Richard A. Smith Bitworks, Inc. >rsmith@bitworks.com 501.521.3908 >Sr. Design Engineer http://www.bitworks.com > About the "strange" opcodes (SKPNZ, SKPC, ...) its what Microchip calls "Special Instruction Mnemonics" and you can find them all in the MPASM manual (Appendix E, Table E.11). About the "btfsc" and "btfss" instructions, I also add the same problem that I solved with the first macro on the following examples. Together are a couple of others that have been making my life easier. Sorry I don't send the whole bunch, but they are commented in Portuguese and it takes long to translate everything. It's nothing special, after all I'm also a beginner I'm only starting my 3rd PIC based projects. But I like macros and the program from were I collected the macros and code segments bellow, had 10 pages of maccro declarations and 2 pages of program (95% macro invocations with a handfull of direct instructions among them). This macros are destinated to a 16C54A PIC, they may require some adjustements for other models. After the macros (only 3) are some code snipsets of an application where they've been used. best regards [] Jorge Ferreira [SNIP] ;------- Testing a bit in a file position -------------------------------- ; ; Parameters: R - RAM (file) address ; B - Bit to be tested (0..7) ; V - Value to test FALSE (0) ou TRUE (1) ; L - Destination label to jump if condition 'V' verifies ; ; Usage: ... ; BitTest TATUS,CARRY,TRUE,C_LABEL ; ... ; (do something if not carry) ; ... ; ... ; C_LABEL ... ; (do something if carry) ; ... BitTest MACRO R,B,V,L if V btfsc R,B else btfss R,B endif goto L ENDM ;------- Test if WDT timed out (to be used on reset vector)---------------- ; ; Parameters: C - Condition TRUE - Yes, there was a WDT reset, ; FALSE - No, it was a MCLR or Power Up Reset ; L - Label for jump when condition 'C' verifies ; TestWDT MACRO C,L if C btfss STATUS,NOT_TO else btfsc STATUS,NOT_TO endif goto L ENDM ;------- Decrement 16 bit counter and jump if ZERO/NON ZERO -------------- ; ; Parameters: HI - File address for HIGH byte ; LO - File address for LOW byte ; C - Condition TRUE - Jump on non zero ; FALSE - Jump on Zero ; L - Label for jump when condition 'C' verifies ; Dec16Jc MACRO HI,LO,C,L LOCAL Fimm decfsz LO,F if C goto L else goto Fimm endif movf HI,F if C BZ Fimm else BZ L endif decf HI,F if C goto L endif Fimm ENDM [SNIP] ;------------------------------------------------------------------------- ; ; Processor configuration and inits ; ORG 0 Init TestWDT FALSE,Normal ; Reset - POR ou MCLR arranque normal bsf PORTB,7 clrwdt goto Wait Normal movlw PA_CFG ; Configurar port de input tris PORTA SetOpt OPT_CFG SetTmr0 TSLICE ; Init timer [SNIP] ... BitTest ESTADO,EID_BIT,FALSE,St_1 ;------------------------------------------------------------------------- ; A STATE - Idle ; ... A STATE CODE ... goto Alarm_Rst St_1 BitTest ESTADO,EBI_BIT,FALSE,St_2 ;------------------------------------------------------------------------- ; B STATE - Box In ; ... B STATE CODE ... [SNIP] St_4 ;------------------------------------------------------------------------- ; E STATE - Reject timing ; Dec16Jc C16_HI,C16_LO,TRUE,Wait ; End of reject time - NO keep going ... ; Reset reject signal ... ; YES - Switch state goto Wait [SNIP] =============================================================== cumprimentos / best regards Jorge Ferreira mailto://jorgegf@mail.telepac.pt ------ Make sure brain is in gear before engaging mouth ------- ===============================================================