Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with Keil assembler code in asm

Status
Not open for further replies.

pisoiu

Advanced Member level 3
Joined
Dec 31, 2002
Messages
750
Helped
43
Reputation
86
Reaction score
17
Trophy points
1,298
Location
Romania
Activity points
7,883
keil related question

Hi,
I am stuck from hours in this stupid keil assembler directives trying to solve a problem, but nothing so far. Here is what I want to do, maybe one more experienced than me can help. All is written in asm.
My device is 51 based, and it has an internal code memory(2k) and external eeprom memory (4k) for constants. The main module needs data (which are mainly ascii strings) from that memory using i2c bus. Those data are defined in external memory in a separate .asm file with:
label: DB 'blablabla'
But in the main code I need pointers to address them and for that I need to exchange labels between modules, in order for MOV DPTR,#label to point to correct address of 'label' in the other module. Let's say I have code.asm the file with main code, and i2c.asm the file for external data. I have managed so far to solve correct pointing address for 'label', but the problem is at the output. I need 2 separate .hex files, one with code and one with content of i2c memory, both starting at addres 0. So far I only got one .hex file at output, with the content of both (code and i2c) files, overlapped at 0. Any ideas? Thanks very much,

/pisoiu
 

C-Man

Advanced Member level 4
Joined
Jul 19, 2001
Messages
1,059
Helped
90
Reputation
180
Reaction score
17
Trophy points
1,318
Activity points
10,191
Re: keil related question

I have done something similiar this way:
when creating the eeprom with your messages also create a table with the adressess and put this table starting at a known adress at the begin (or at the end) of your eeprom.

Number your messages like 0, 1, 2, 3 ...

Whenever you want to get a message get its number, multiply by two, read its adress from your eeprom and use this adress to get your message.

The only disadvantage of this method is that you need more space in eeprom and also you need a little longer to get each message and if you change your messages you must remember to update your message numbers.

hope this helps and best regards
 

pisoiu

Advanced Member level 3
Joined
Dec 31, 2002
Messages
750
Helped
43
Reputation
86
Reaction score
17
Trophy points
1,298
Location
Romania
Activity points
7,883
Re: keil related question

Thanks. It is a good trick, and if I remember correctly it is called URI scheme (Uniforme Resource Identifyer), and it is implemented in http/tcp/ip software implementation for scenix-ubicom microcontrollers. But I think somehow this can be done with assembler directives. For many embedded system developers I think is a common practice to keep non-code data such as strings for various peripherals (ex. gsm at initialisation commands) out of their main code memory, which is often a tight space in embedded design. Somehow this can be done....

/pisoiu
 

svicent

Full Member level 6
Joined
Jul 11, 2001
Messages
322
Helped
33
Reputation
64
Reaction score
7
Trophy points
1,298
Activity points
2,293
Re: keil related question

If you need 2 separate .hex files, you will need two projects, one with code (main.asm) and one with content of i2c memory (i2c.asm).

Regards, svicent
 

fireplus

Full Member level 3
Joined
Oct 31, 2003
Messages
182
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Activity points
1,633
Re: keil related question

this is the solution :

1- creat file and save it as i2c.asm
2-write in this file all the routines of the i2c eeprom

as :

read_add:
mov r1,A ; a have the address want to read
......
......
......
ret

3-after you write all your routines creat anthoer file called it Main.asm
4- in the main write the following :

org 00h
ljmp start

org 30h
#include <i2c.asm>
start:
mov A,#02h
lcall read_add
ljmp start

end



sorry for my bad english :oops: ,i hope that help you
bye

Fire in the Wire :sm2:


l
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top