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

Regards
Nisar Ahmed
Wed Jul 29 2009, 05: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..
Wed Jul 29 2009, 11:40 PM
#7
There is no any warning.
Fri Jul 31 2009, 02: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, 02:56 PM ]
Tags keil assembly programmingkeil C calling label external file
Fri Jul 31 2009, 11:30 PM
#9
Thanks for help
Mon Aug 03 2009, 01: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, 01:13 PM ]

Get Social

Information

Powered by e107 Forum System

Conversation

Sat Sep 20 2014, 02:20 AM
1
-1'
Sat Sep 20 2014, 02:19 AM
-1'
1
ExperimenterUK
Sat Sep 13 2014, 12:34 PM
jaimin1212,Pimpalkhare Create a thread for your question
jaimin1212
Sat Sep 13 2014, 02:35 AM
i want to make self balancing robot using MPU6050 using atmega8.. please help to get data of gyro and accelerometer from this sensor through atmega8.
Thu Sep 11 2014, 09:00 AM
Sunil Pimpalkhare
Hello sir, I am trying to make Wearfin project https://www.youtube.com/watch?v=iZ6PVBvQf-g so can u help me in teaching how to built the program???
Thu Sep 11 2014, 02:21 AM
hariom panday
plz hlp me in my project
iec.naga
Tue Sep 09 2014, 01:19 AM
spi
Mon Sep 08 2014, 08:14 AM
fameem
water changing in fish tank automatically using microcontoller with timer. send idea to me
dexter_a
Sat Sep 06 2014, 11:09 AM
hello guys
Sat Sep 06 2014, 10:10 AM
munaxa
plx guide me

Downloads

Comments

deepbhadani
Fri Sep 19 2014, 01:08 PM
desaiakshay92
Fri Sep 19 2014, 12:45 AM
Fiddu
Thu Sep 18 2014, 02:28 AM
piku_123
Tue Sep 16 2014, 11:29 AM
qudor
Tue Sep 16 2014, 11:06 AM
sara_seecs
Tue Sep 16 2014, 10:53 AM
akshar
Fri Sep 12 2014, 12:45 PM
iec.naga
Tue Sep 09 2014, 01:09 AM

Online

Guests: 52, Members: 0 ...

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

Members: 37517
Newest member: deepbhadani
Forum Activity
kirangowle Avatar
Posted By kirangowle
Sat Sep 20 2014, 12:35 AM
Hello All,I want to connect normal speaker (as a s...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 12:59 AM
I think its important to list out the features of ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 12:45 AM
you need to put a wait condition in ISR till the s...
akshar Avatar
Posted By akshar
Mon Sep 15 2014, 04:41 AM
sir,i used microcontroller 89v51rd2 in circuit. No...
bobparihar Avatar
Posted By bobparihar
Mon Sep 15 2014, 02:24 AM
i am programming interrupt 0 using 8051my task is....
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Sep 13 2014, 12:23 PM
There may not be an exact equivalent .You will hav...
akshar Avatar
Posted By akshar
Sat Sep 13 2014, 03:18 AM
Sir, Good Morning,Thank you for making me a member...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 12:52 AM
which compiler are you using? I suggest XC8 with M...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 12:49 AM
I always prefer Olimex Dev boards when it comes to...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 12:44 AM
master will always lower down the Chip select... s...