Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use: #INCLUDE "***.ASM" in PIC?

Status
Not open for further replies.

devonsc

Advanced Member level 4
Joined
Nov 30, 2004
Messages
115
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Activity points
1,931
Hi there,

I've seen someone writing the code for PIC in this manner. May I know is this possible? By writing certain subroutines and save them. Then, use "CALL" to call them according to the name of the *.asm file in the main programme. Where one initialize the subroutines using:

#INCLUDE "NAME.ASM"

But would like to ask for advice where and how do I save the prepared subroutines? Do I just have to save all the *.asm files into the same folder?

Thanks in advance...
 

Salam,

**broken link removed**

Bye
 

Thanks Sphinx!
 

You forgot, no thanks in the post!

#INCLUDE is just assembler directive. You place it where you want assembler to include other *.asm file. Generally, it is not related with subroutines. You use it just to have your program splitted in several files.

maranaza
 

Oops...okay :) No thanks in the post, sorry.

Meaning, it doesn't matter where we save the files? It is not like C++ or something? But how does the main programme knows if I were to write a subroutine and name it..say "ABC" then I write:

#INCLUDE "ABC.ASM"

When I call, I just write:

CALL ABC

The main programme will know where to load my subroutine from? Real sorry if Im talking nonsense. Please don't get mad...
 

You can place all project files in the same folder. If the file is in another folder, use full name with path, when you want to include it with the #include directive.

You did not read my reply. As I said, it has nothing to do with subroutines. Subroutines are another thing. If you write "call ABC", it means put <PC+1> to the stack and jump to the address whoose label is ABC.

If you have your subroutine saved in the separate file called abc.asm, than in the main program, you have to put somewhere a label "LABEL_ABC", and then include the file, like this:

LABEL_ABC:
#include "abc.asm"
.........

You can call this subroutine like this:

call LABEL_ABC

and not like this:

call abc

unless the first line in the file "abc.asm" is label called "abc".

maranaza
 

Sounds like you should be using the librarian in Mplab. It would be better to make a library of your routines, this can be done with project options, then just put 'Files mylib' in your linker script file to use them. The linker will only link in the routines used.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top