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


Sun Oct 23 2016, 05:50 PM
mamata thakur
plz send full mini project report for ic 741&ic 555 tester
Wed Oct 19 2016, 03:30 PM
can you provide an explanation for the inverter 8051 code and how it works
Sat Oct 15 2016, 12:15 AM
@snaya. Create a thread in the 8051 forum for your questions
Fri Oct 14 2016, 10:00 AM
i m going to make a project with 8051and the name is scrolling led message display .now i wanna ask so many of questions.may be u can help me .so help me out
Fri Sep 30 2016, 10:40 AM
plz I want code for adc interfacing with8051
Sun Sep 25 2016, 04:41 AM
hi sir, could you help me regarding simple multiplication calculator?it should be include with buzzer. i use dragonplus. please
Sat Sep 24 2016, 05:49 PM
@Rus Ans .. what project ?
Sat Sep 24 2016, 05:48 PM
@engr1931 depends on type of scanner
Sat Sep 24 2016, 03:07 PM
Is it possible to send data from 2 barcode scanner to pc using serial port using 8051?
Wed Sep 21 2016, 02:22 AM
Rus Ana
can anyone help me for my project? T.T



[email protected]
Fri Oct 21 2016, 10:35 PM
Sat Oct 15 2016, 09:40 AM
Wed Oct 05 2016, 08:16 AM
Mon Oct 03 2016, 07:37 PM
Thu Sep 29 2016, 06:31 AM
Thu Sep 08 2016, 06:28 PM
Sat Aug 20 2016, 01:44 PM
Thu Aug 18 2016, 12:24 PM
Forum Activity
Pratik_Suthar Avatar
Posted By Pratik_Suthar
Thu Oct 13 2016, 12:39 PM
@martin the HEX file provided in the project is no...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Oct 06 2016, 06:15 AM
Hi Phil, Do you want to add this to existing proje...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Oct 06 2016, 06:13 AM
CE should be high when you go for reading mode/wai...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Oct 06 2016, 06:03 AM
You can also use ESP8266 with its SDK to write app...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Oct 03 2016, 11:15 PM
This is an old thread and the links no longer work...
martinsnc115877 Avatar
Posted By martinsnc115877
Wed Sep 14 2016, 12:51 PM
sir, i did your led scrolling mass display, and it...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Sep 09 2016, 11:45 PM
The Hex file for this project is a bit too big for...
rajavarmanslr Avatar
Posted By rajavarmanslr
Thu Aug 18 2016, 01:40 PM
I have two 8051 that interfaces with nRF24l01. One...
rajavarmanslr Avatar
Posted By rajavarmanslr
Thu Aug 18 2016, 12:31 PM
I have two 8051 that interfaces with nRF24l01. One...