Searching \ for '[PIC] PIC16F916 Error [474] compiling assembler f' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'PIC16F916 Error [474] compiling assembler f'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] PIC16F916 Error [474] compiling assembler f'
2012\04\07@165320 by AdiCH


I try to compile the assembler example from the

"HI-TECH C® for PIC10/12/16 User’s Guide" page 91.

my file main.c

// declare the assembly routine so it can be correctly called
extern unsigned int add(unsigned a, unsigned b);

void main(void) {
       int a, result;
       a = 8;
       result = add(5, a); // call the assembly routine

assembler file (

#include <aspic.h>

       GLOBAL _add,?_add ; make _add globally accessible
       SIGNAT _add,8298 ; tell the linker how it should be called
       FNSIZE _add,0,4 ; this required 4 bytes of params; no autos
       ; everything following will be placed into the mytext psect
       PSECT mytext,local,class=CODE,delta=2
       ; our routine to add to ints and return the result
       ; params are loaded by the calling function;
       ; we access them here using the special symbol
       BANKSEL (?_add) ; select the bank of this object
       MOVF BANKMASK(?_add+2),w ; take the LSB of the second param
       ADDWF BANKMASK(?_add),f ; add to the LSB of the first param
       BTFSC STATUS,0 ; check for carry
       INCF BANKMASK(?_add+1),f ; handle carry
       MOVF BANKMASK(?_add+3),w ; take the MSB of the second param
       ADDWF BANKMASK(?_add+1),f ; add to the MSB of the first param
       ; the result is already in the required location so we can
       ; just return

If I compile this with the MPLAP IDE V8.84 for the PIC16F916 I get the

Error   [474] ; 0. no psect specified for function variable/argument

Is something wrong with the definition of PSECT or what else do I have to


View this message in context:
Sent from the PIC - [PIC] mailing list archive at

2012\04\10@022812 by Wouter van Ooijen

face picon face
>        PSECT mytext,local,class=CODE,delta=2

I use

                PSECT text0,local,class=CODE,delta=2

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica:
consultancy, development, PICmicro products
docent Hogeschool van Utrecht:
C++ on uC blog:

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