Discussion in "8051 Discussion Forum" started by    Nisar Ahmed    Jul 27, 2009.
Mon Jul 27 2009, 02:25 PM
#1
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
#2
have u added the file to your source group of "main.asm"?
Mon Jul 27 2009, 07:22 PM
#3
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
#4
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
#5
Now it's ok
In" main.asm" file .I use directive #include<table.asm>

Regards
Nisar Ahmed
Wed Jul 29 2009, 09:16 PM
#6
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
#7
There is no any warning.
Fri Jul 31 2009, 06:54 PM
#8
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
MOV R2,R1
ADD R2,R0
RET


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
#9
Thanks for help
Mon Aug 03 2009, 05:10 PM
#10
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

Information

Powered by e107 Forum System

Conversation

ExperimenterUK
Mon Apr 27 2015, 05:27 AM
@mostfa.. it's a browser thing. Check your settings/try another browser.
Sat Apr 25 2015, 06:16 AM
rohan_verma
sir this circuit is tested?can i use it directly on developing PCB
Sat Apr 25 2015, 06:13 AM
rohan_verma
MSCOMM32.ocx cannot be copied in the systems folder even with administration rights.
Fri Apr 24 2015, 01:58 AM
mostfa
please fix the LCD Interfacing Tutorial as all pictures is gone
Fri Apr 24 2015, 01:57 AM
mostfa
LCD Interfacing Tutorial
Qasim359
Tue Apr 21 2015, 07:31 AM
hello every one i have made pic industrial and domestic timer and i can,t understand c code written in Hi-Tech please send me Mikroc code for this project anyone...................
ExperimenterUK
Wed Apr 15 2015, 05:07 PM
@Bibek.. and everyone. Create threads if you need help. The chat box is just for chat
ExperimenterUK
Wed Apr 15 2015, 05:06 PM
@mohd atif ..login..create a post/thread,then I can post a copy of the missing file
Mon Apr 13 2015, 07:03 PM
mohd atif
@experimenteruk I didn't get you
Sun Apr 12 2015, 04:18 AM
Bibek
hello, i have made a digital clock using rtc DS12887 and AT89S52 with date n callender. Now i want to add alarm features to it.....can any body help me with the code in assembly language

Downloads

Comments

Seven
Thu Apr 23 2015, 12:02 AM
killbillpandey
Wed Apr 22 2015, 09:07 PM
Qasim359
Tue Apr 21 2015, 07:06 AM
lumines
Sat Apr 18 2015, 11:30 PM
[email protected]
Sat Apr 18 2015, 05:02 PM
arvindarunoday
Sat Apr 18 2015, 04:26 PM
samarhbk
Sat Apr 18 2015, 12:57 PM
chitty789
Tue Apr 14 2015, 06:14 PM

Online

Guests: 46, Members: 0 ...

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

Members: 37629
Newest member: Seven
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Apr 25 2015, 06:03 PM
plz tell me how i edit this code file in MPLAB if ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Apr 23 2015, 08:00 PM
gsdvprasad Avatar
Posted By gsdvprasad
Thu Apr 23 2015, 12:49 PM
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 21 2015, 04:37 PM
I doubt anyone has Mikroc code.It is probably more...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Apr 21 2015, 04:24 PM
A multimeter won't help :(The most practical way i...
ankitbajaj01 Avatar
Posted By ankitbajaj01
Tue Apr 21 2015, 03:21 PM
As I don't have CRO, Can we test the crystal with ...
Qasim359 Avatar
Posted By Qasim359
Tue Apr 21 2015, 07:26 AM
i can,t understand C Code written in Hi-Tech pleas...
gaurav7577 Avatar
Posted By gaurav7577
Mon Apr 20 2015, 07:04 AM
k..let me make all this simple for u so u can add...
ajay_bhargav Avatar
Posted By ajay_bhargav
Sun Apr 19 2015, 06:50 PM
Please zip and attach the code in future. You forg...
ajay_bhargav Avatar
Posted By ajay_bhargav
Sun Apr 19 2015, 06:48 PM
It is really hard to say which course and/or insti...