Discussion in "8051 Discussion Forum" started by    Nisar Ahmed    Jul 27, 2009.
Mon Jul 27 2009, 02:25 PM
Hello everyone
I have a file" table.asm",I want to include with another file" main.asm".Plz help me how i call file "table.asm"in the file "main.asm".I have using Keil assembler.

Thanks in advance
Nisar Ahmed
Mon Jul 27 2009, 05:03 PM
have u added the file to your source group of "main.asm"?
Mon Jul 27 2009, 07:22 PM
there are rules to follow when writing distributed assembly code..
you can download the PDF document from download section regarding Assembly programming in keil.

look for the use of keyword
"extrn" and "segment code" etc.
Tue Jul 28 2009, 06:37 PM
hi guys.. can any 1 post a ScreenShot of them working with multi-file (asm)..
i wana see the declarations made in main pgm and sub-pgms..
Wed Jul 29 2009, 08:39 AM
Now it's ok
In" main.asm" file .I use directive #include<table.asm>

Nisar Ahmed
Wed Jul 29 2009, 09:16 PM
make sure you are not getting any warnings coz that can ruin your program.

to call a routine from external asm file.. you need to declare that segment as public. i will give you an example soon..
Thu Jul 30 2009, 03:40 AM
There is no any warning.
Fri Jul 31 2009, 06:54 PM
here is the exact Keil example..

File: ADD.asm

;Add routine which will be called from other file
PUBLIC ADDNUM ;declare function as public

ADDNUM_ SEGMENT CODE  ;define code segment for linker
RSEG ADDNUM_ ;select segment ADDNUM

ADDNUM:  ;Our add routine

File: Test.asm

EXTRN CODE (ADDNUM) ;define the external symbol

CSEG at 0 ;code starts at 0
MOV R0,#50  ;Some dummy instructions
MOV R1,#51
ACALL ADDNUM ;lets call this routine which is in second file

Link it and check..

[ Edited Fri Jul 31 2009, 06:56 PM ]
Tags keil assembly programmingkeil C calling label external file
Sat Aug 01 2009, 03:30 AM
Thanks for help
Mon Aug 03 2009, 05:10 PM
Ok i guess Ajay's example is enough to learn the multi file concept..

I have written a code of about 31KB in a notepad which includes main pgm, LCD initilizations, 3 timer configurations and settings, ADC and its lookup table, Serial intializations and its Tx and Rx, keypad routine and some more things..

Unfortunately i dont know the concept of multi file in asm formats and i have written all these in a single file with countless jumps.... Thank god its working and thanks to JTAG debugger as well...

Now i wana seperate them into individual files and add them into my project...

So i request any 1 to plz share me a project where such concept of multi files is used... so i can get a clear idea of it...

And i dont understand why multi file is required when the solo single file is working fine....

Anyways both formats jumps to specified sequence right ? Can any 1 plz explain why they insist on multifile ?

[ Edited Mon Aug 03 2009, 05:13 PM ]

Get Social


Powered by e107 Forum System


Mon Nov 23 2015, 06:32 PM
طريقة عمل مشروع dtmf على الماتلاب بالتفصيل
Mon Nov 23 2015, 02:26 PM
Muhammad Naveed kayani
principal of Electrical circuits 8th Edition, by Thomas L. Floyd , Prentice Hall please send me ... ??
Sun Nov 22 2015, 03:20 AM
@Naresh Jain ..hex file for what ?
Thu Nov 19 2015, 04:16 PM
Naresh Jain
can u arrange hex file
Thu Nov 19 2015, 04:14 PM
Naresh Jain
where is PCB file ? there is error.
Thu Nov 19 2015, 02:25 PM
hello all
Thu Nov 19 2015, 03:31 AM
@Bhaveen Lodaya.. can you rejoin as a new user
Wed Nov 18 2015, 03:39 PM
Bhaveen Lodaya
@Ajay... I forgot my username and password as I haven't used this site for a very long time. Please help me reset it. I am not receiving the password reset emails too.
Sun Nov 15 2015, 04:31 AM
@Phil, please check my PM and reply.
Thu Nov 12 2015, 08:50 PM
@Ajay.. PM sent.. just routine stuff



Sat Nov 21 2015, 09:19 PM
Sat Nov 21 2015, 07:05 PM
Mon Nov 16 2015, 11:49 PM
Wed Nov 11 2015, 09:02 PM
Wed Nov 11 2015, 09:20 AM
Tue Nov 10 2015, 11:12 PM
Thu Nov 05 2015, 06:27 PM
Thu Nov 05 2015, 01:03 PM


Guests: 40, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37715
Newest member: emreaydogmus06
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Nov 12 2015, 08:58 PM
Your problem may be the mismatch of a 3.7 volt mic...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 12 2015, 04:21 PM
Length of tracks or wires depends on drive strengt...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 12 2015, 04:13 PM
Sure, we will be interested in discussing your pro...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 12 2015, 04:09 PM
For AC devices, power = area under the curve so if...
gauravkothari23 Avatar
Posted By gauravkothari23
Wed Nov 11 2015, 09:10 PM
HI all,I am making a small project in which i am u...
csedwards1965 Avatar
Posted By csedwards1965
Tue Nov 10 2015, 11:20 PM
Hello.I am struggling to get the project lab going...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 06 2015, 01:21 AM
Mains fan motors are generally meant to only run a...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 06 2015, 01:12 AM
The key thing is the length of the interrupt code....
bobster Avatar
Posted By bobster
Thu Nov 05 2015, 06:39 PM
Hi all,I am using an atmel 89c5131 microcontroller...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Nov 05 2015, 12:20 PM
8086 is a microprocessor with only a CPU. It does ...