Bob, I think you're confusing BANKSEL with PAGESEL. BANKSEL refers to RAM bank selection and has nothing to do with PCLATH. Dave D. You wrote... >Answers below: > >At 12:50 AM 10/26/2003, you wrote: >>;***************************************** >> IFNDEF _DLYMACRO_INC >>#DEFINE _DLYMACRO_INC >> >> INCLUDE "p16f628a.inc" >> >>DLY_10ms macro >> >>; Delay = 0.01 seconds >>; Clock frequency = 4 MHz >> >>; Actual delay = 0.01 seconds = 10000 cycles >>; Error = 0 % >> >> >>FIXED_REGISTERS UDATA >> local d1, d2 >>d1 res 1 >>d2 res 1 >> >> CODE >>Delay_10ms >> ;9993 cycles >> movlw 0xCE >> BANKSEL d1 >> movwf d1 >> movlw 0x08 >> movwf d2 >> >>Delay_0 >> decfsz d1, f >> goto $+2 >> decfsz d2, f >> goto Delay_0 >> >> ;3 cycles >> goto $+1 >> nop >> >> ;4 cycles (including call) >> BANKSEL 0 >> return >> >> endm >> >> ENDIF >>;********************************* >> >>it assembles with MPASM and it isn't any different than the psuedo code i >>put in my >>original post. >> >>1) is BANKSEL 0 as opposed to BANKSEL varname_in_bank0 acceptable? > >Yes. MPASM assumes '0' to be in the default radix and will generate the >proper code. It will generate > >movlw 0 >movwf PCLATH > > > >>2) what code does the psuedo-mnemonic "BANKSEL var" generate? >> a) bcf STATUS, RP0 ?? >> >> -or- >> >> b) movf FSR, bank2var >> movwf INDF > >No. It has nothing to do with FSR, only PCLATH. It generates: > > movlw bank2var > movwf PCLATH > > >HOWEVER, If you are using any MPLAB before 5.4, MPASM sometimes makes an >error in its generation of BANKSEL. I therefore long ago replaced BANKSEL >with my own MACRO, which never made an error after the change. > >Finally, since BANKSEL is actually a 2-line macro substitution, your code >will NOT work properly if you use any skip instructions with it, such as: > >BANKSEL bank1var >btfsc STATUS,C >BANKSEL bank2var >etc >etc > >--Bob > > >-------------- >Bob Axtell >PIC Hardware & Firmware Dev >Tucson, AZ >1-520-219-2363 >"I lose some on each sale but make it up in volume." -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.