John Piccirillo wrote : > >Yes, since it has the same address as "RESET_VECTOR". > > Sorry, a typo. I did use INT_VECTOR CODE 0x004 followed by > a simple ISR, just context saving, [code below] but the > assembly error was: OK. You better cut-n-paste in the future. Or review your posts a second time before hitting send... :-) > Error - section 'INT_VECTOR' can not fit the absolute section. > Section 'INT_VECTOR' start=0x00000004, length=0x00000010 Of course, the section is 10 bytes (as the message above says) and if you add more code then that, you get that message. No problem with that. > > The CODE is used anywhere where you wan't to start a new > > code segment. > > I hope you have the patience to tell me how that is used. > Where would > it be useful to have different CODE sections. Different CODE sections will be separatly listed in the MAP file so you get sizes calculated "for free". Separatly CODE sections will be individualy placed in the program memory by the linker. So one can place a hardcoded table in the middle of the program address area, and the linker will nicely spread the code segments around that. If you arrange your source code using multiple ASM files, you *must* have at least *one* CODE segment/diretive per file (but can have more then one to make the "job" for the linker easier, the code more structured and the output of the linker a bit more "usuable"). > Please feel free to comment on the form of the code. How do I treat > the portb equate, What is "the portb equate" ? PORTB is PORTB... > RES doesn't seem to work. RES have noting to to with the SFR's ! You use RES to allocate your variables from the GPR's ("RAM"). > If I follow the > interrupt vector with a goto iserv and put the ISR down under Main Code, it > assembles. As expected... > > list p=16F84 > #include First, if you don't have any *specific* reason to use the old/costly F84, make yourself a big favour and use somthing modern. If it's for general PIC learning, maybe a rather simple 16F628A would work (still can a lot more then the F84 at half the price...). > > INT_DATA UDATA 0x0C > portb equ 0x06 PORTB is defined in p16F84.inc. Remove that EQU !! > w_temp RES 1 ; variable used for > context saving > status_temp RES 1 ; variable > used for context > saving Yes, that's right. See the MAP file to see the "real" addresses, (even if they realy doesn't matter...). > > ;************************************************************* > ********* > RESET_VECTOR CODE 0x000 > goto start > > INT_VECTOR CODE 0x004 > > movwf w_temp > movf STATUS,w > movwf status_temp > > ; isr code can go here or be located as a call subroutine elsewhere Yes, *if* shorter then the lenght of section "INT_VECTOR" in the linker script (see the LNK file). > > movf status_temp,w > movwf STATUS ; > swapf w_temp,f > swapf w_temp,w > retfie > > MAIN CODE > start movlw 0x00 > tris portb TRIS is an "depricated" assembly instruction. Maybe not in the F84 data sheet, but in practicly any other data sheet from a current PIC type. Use MOVWF TRISB, instead. > movlw 0x0f > movwf portb > > circle goto circle > > END > Regards, Jan-Erik. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist