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
Sun Feb 04 2018, 09:38 PM
Hi Dave. Good to see you.
DavesGarage
Tue Jan 09 2018, 07:55 PM
It's been a few years since I poked around here - Hi all...
ExperimenterUK
Mon Jan 08 2018, 07:19 PM
Hi TPS. it's been a while..
۞ TPS ۞
Sun Jan 07 2018, 06:42 PM
hello
Thu Jan 04 2018, 01:50 PM
sayyad affrid
its AT89S52
Thu Jan 04 2018, 01:50 PM
sayyad affrid
sir, i want embedded c code for ultrasonic sensor having buzzer interfaced with AT9S52
Mon Dec 18 2017, 08:12 PM
zafir
i am making digital voltmeter using AT89C51, ADC and LCD 16x2,,, kindly someone please send me hex file in assembly language
Fri Dec 15 2017, 12:18 PM
mehari
can not find dhtxx.md file in proteus 8.0 can anybody help me please?
sahar7478
Fri Dec 08 2017, 12:47 PM
can i get gsm a6 library? can anybody help? tia
Faiqa
Sat Nov 25 2017, 08:32 AM
Can i get the code of Monitering and controlling of green house effect? ... Can anyone help me ?

Downloads

Comments

justotemon
Sat Feb 17 2018, 07:14 AM
nicolekristen
Fri Feb 16 2018, 12:19 PM
pavithrann
Wed Feb 14 2018, 04:46 PM
Tue Feb 13 2018, 03:18 PM
SDN1964
Sun Feb 11 2018, 12:00 PM
Nickynet
Sat Feb 10 2018, 11:02 PM
paulfjujo
Thu Feb 08 2018, 09:01 AM
holdthedoor264
Tue Feb 06 2018, 06:49 AM

Online

Guests: 58, Members: 0 ...

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

Members: 37963
Newest member: justotemon
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Feb 14 2018, 08:43 PM
>strange to don't define the way Write or Read..fo...
paulfjujo Avatar
Posted By paulfjujo
Wed Feb 14 2018, 02:25 PM
hello,Thank for your answer, but today i wrote thi...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 09:43 PM
Glad you sorted it.I'm sure you will remember if f...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 09:38 PM
>When i initialise UART_Init (9600); i get error=1...
Martinv Avatar
Posted By Martinv
Tue Feb 13 2018, 09:26 PM
Mmmm feel quite silly, but learned a lot. I must ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 08:07 PM
Can you zip and attach your full code.Using a seco...
paulfjujo Avatar
Posted By paulfjujo
Tue Feb 13 2018, 12:28 PM
hello,i tried this litle code with MikroC for 8051...
Martinv Avatar
Posted By Martinv
Tue Feb 13 2018, 09:22 AM
Thanks for the reply. The part of the main loop t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 01:12 AM
Unless "READSMS" has some very long delays I doubt...
paulfjujo Avatar
Posted By paulfjujo
Sun Feb 11 2018, 06:52 PM
hello,The chip is probably locked.Why not build t...