Continue to Site

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.

Interfacing a memory card with AT89C52 for storing the code

Status
Not open for further replies.

Help

Advanced Member level 2
Joined
Feb 15, 2005
Messages
617
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Activity points
7,065
Hi,

I would like to comfirm the code size for AT89C52. I'm using Keil compiler. Is it after we compiled our coding it will show Program Size: data=256 xdata=0 code=5396. Is it the AT89C52 code limit size is 8000? Currently my code=5396, which mean i still have 2604 code size for me to write my coding, am i rite? I have using 62256 SRAM on the testing board for external data, not sure whether have any external code? Is it possible to add the external code size?

I'm worry, my coding is gonna to reach 8000 soon... :(

Thank you.
 

error a45: undefined symbol (pass-2)

Any 8051-derivative (AT89S52 incl) can use 64kB of program memory (more with banking) ..
If the EA pin is tied up to 0V microcontroller will fetch all instructions from external program memory, if EA connected to +Vcc it will first use 8kB from internal flash and after that it will automatically increase the PC to addresses above that – of course if the external program memory physically exists and a code resides in it ..

And one more thing, your 32kB SRAM in certain circumstances can be used to store program code – how will you get it there is a different kettle of fish – but usually it is used as data memory and has nothing to do with the size of the code ..

It’ possible that the code size limitation you are running into are a restriction of the evaluation version of the Keil tools ..
You will need to purchase a full version of the Keil tools if your code is larger than that, or switch to a different toolset ..

Rgds,
IanP
 

    Help

    Points: 2
    Helpful Answer Positive Rating
how to burn at89c52

Hi,

Feel like abit complicated after i done some research on external code memory. To extend the internal capability code size for 89c52, is it we have to use external EPROM (eg. 27C256, AT29C010A,..) to burn the firmware? To use EPROM we need to have a EPROM burner, i don't have universal programmer at this moment. Is it have any other alternative method to extend the MCU code size?

..your 32kB SRAM in certain circumstances can be used to store program code..
Is it the SRAM also can be store the program code? If yes, then we can do the mapping 16kB for data and 16kB for code or we can use 64kB SRAM to increase the memory size then do the mapping for data and code.

At the same time i have find some circuit about the EPROM burner. Please have a look..
**broken link removed**

Thank you.
 

rom burner for at89s52

You can use flash memory. If you connect it correctly you can use the 89c52 to program the flash memory. It is a bit complicated to explain how to do this but it goes something like this....
Connect the flash to the 89c52 with some external logic that allows the flash to either appear as ram to the micro or as rom. To program it select the ram space and write to it as external ram. Then select rom space. You need the program to be running in the internal progr space when this switching happens. The other option you can connect ram that it can be selected as external ram or rom. Downside here is you need a battery to keep your program safe in the event of a power failure
 

    Help

    Points: 2
    Helpful Answer Positive Rating
which software will support to burn the at89c52

Hi davidgrm,

Very happy to heard that SRAM is posible to do that. But i still don't understand how to make it.
Can we just start the circuity. Let's say we have x2 SRAM. One for ROM another is for RAM space.
Q1:
To program it select the ram space and write to it as external ram.
What do you mean. Is it we have to write the code to 1st external RAM? How to write the code to 1st RAM? ( assume 1st SRAM is ROM? )
Q2:
Then select rom space
After all the code is write to 1st SRAM(for ROM space) then the 2nd SRAM is for RAM space. But in our programing we have to do the memory switching am i rite?
Q3:
need a battery to keep your program safe in the event of a power failure
Is it the 1st SRAM(ROM space) must have the battery backup? How it need battery to backup?

Do you have the reference circuit? Can you share it? If the power is failure then later the power is up the data will be back. Base on Q1, write the code to 1st SRAM again, am i rite?

Thank you.
 

89c52 memory card asm file

Hi
Its been a long time since I used this chip but here goes... You must connect the RD and the PSEN via an and gate to the RD of the ram chip. The WR of ram goes to WR of micro. Of course you must look after address decoding and CS etc. With this connection it allows the program to be run from RAM. Take a look at this link https://www.keil.com/download/docs/192.asp or search google with "8051 program ram"

Q3 - Battery backup. Well if the program data is in ram you will lose it when the power goes off. This means you should use low power cmos static ram. You then take a 3v battery and connect it via a diode to the ram power,RD, & WR pins. You also need to disconnect the RD & WR from the rest of the circuit using transistor. You should also have a reset circuit to do this disconnection before power gets too low. Now that I remember all of these issues I think it would be simpler to use a flash chip instead of ram :)
 

    Help

    Points: 2
    Helpful Answer Positive Rating
coding for at89c52

Take a look at this:
**broken link removed**
It shows how to connect SRAM to 8952 and how to run programs from it using MONITOR program that resides in the 8952 and HyperTerminal to download HEX files to SRAM ..
As far as battery backup is concern, the best thing to do is to employ supervisory circuit such as the DS1210 (for 1 SRAM) - on the MAXIM-DALLAS website you can find PDFs with application notes ..
Other option is a matrix with diodes .. see attached picture ..

Just one other thought: if you want to "play" with 8051 and SRAM - that's a good exercise, but you may consider another 8051-derivative with, say, 64kB of FLASH, RAM and so on - everything already inside - and here is one example: DS89C450 ..

Rgds,
IanP
 

    Help

    Points: 2
    Helpful Answer Positive Rating
spi at89c52 code

Hi,

So, now what i need to do is to download the hex(firmware) to SRAM then the MCU will use SRAM to run. Since we the the hex will lose after the power is off. I plan to use MMC as my storage. Is it possible to download the hex to MMC then download the hex again to SRAM and run the MCU?
So, we can no worry about the bettery backup and at the same time we can have a big storage for DATA and CODE.

Currently i have a burner for at89c52 and the circuit for SRAM just have to do add one inverter on A15. The next step is burn the "helo.hex" to MCU then use the XTALK to testing, use XTALK to download the hex data to SRAM, am i rite?

Thank you.
 

at89c52 expand

It's not so easy to interface MMC card to 89C52, as the 89c52 doesn't have hardware SPI port ..
On top of that data stored on MMC card is normally in FAT16/FAT32 format and the read/write procedure for an MMC card involves accessing 512 byte chunks at a time ..

Battery backed-up SRAM works quite well ..

You have to burn MyPAULM2.hex to the 89C52 ..
This will alow you to transfer hex files from PC to SRAM, so you can download HELO.hex to SRAM and try to run it from there ..

Rgds,
IanP
 

    Help

    Points: 2
    Helpful Answer Positive Rating
dump_key.exe

Hi,

Thank for your advice, Ianp. Ok, let me try transfer hex files from PC to SRAM first. I will try the MMC later.

May i know temporary can we use Proteus to simulate it? Please can you teach me how to use commands? I'm running in Protues Virtual Terminal. PAULMON2 Loc:8000 > what should i type here? When i type "L" the Virtual Terminal will show 8000 to 8013 is NOP. I have tired "?" command and tested all the command but still look like no data in SRAM.
What should i do now?

Please advice..

Thank you
 

8051 code size

Dallas sell ram modules that have a battery built into them. This will make your design easier
 

    Help

    Points: 2
    Helpful Answer Positive Rating
kiel erase ram

Here are keys used by PaulMon2:
Code:
.equ	help_key, '?'		;help screen

.equ	dir_key,  'M'		;directory

.equ	run_key,  'R'		;run program

.equ	dnld_key, 'D'		;download

.equ	upld_key, 'U'		;upload

.equ	nloc_key, 'N'		;new memory location

.equ	jump_key, 'J'		;jump to memory location

.equ	dump_key, 'H'		;hex dump memory

.equ	intm_key, 'I'		;hex dump internal memory

.equ	edit_key, 'E'		;edit memory

.equ	clrm_key, 'C'		;clear memory

.equ	erfr_key, 'Z'		;erase flash rom
All keys are in Upper-Case ..

More details are here:
**broken link removed**

Rgds,
IanP
 

    Help

    Points: 2
    Helpful Answer Positive Rating
at89c52 corrupted ram

Hi,

Yes, i already key in all the character. Not sure, may be the Proteus can't make it. I will try on hardware and see what's the result. Later i will test it on hardware because wanna to buy the inverter IC and add in.

I'm not so fimiliar with assembly language. I know about C.

Thank you.
 

code for at89s52 controler step

If you want to power down your micro but leave the memory with power you must connect the WR line of the memory and the CS to hi from the battery. Failing to do this will cause your data in ram to become corrupted. I mentioned earlier using a transistor. This is how... use an NPN - connect emitter to WR of micro. Connect base via a resistor to reset circuit, connect collector to WR of ram. Put a 10K pullup resistor between the WR pin of ram and the battery power. Repeat this circuit for CS. The reset circuit should detect when power fails. There are many ways to do this. When power fails on micro there will be a certain point when the data and address lines of the micro are in an undetermined state and so it is important that CS and WR are held hi before micro stops working.
 

    Help

    Points: 2
    Helpful Answer Positive Rating
at89s52 programer errors how to salve

Hi Ianp,

I forget one thing, my board are using 22.1184MHz. Is it the mypaulm2.hex still can support this crystal? I don't know how to change the .asm file. Is it possible to change the .asm file to suit the crystal? What can i do now?

Thank you.
 

pin ea at89c52

Looks like this MONITOR supports the AUTO-Detection option ..
If you prefer to communicate with it at fixed baud rate just find in the *.asm the following:
Code:
; To set the baud rate, use this formula or set to 0 for auto detection

; baud_const = 256 - (crystal / (12 * 16 * baud))


.equ	baud_const, 0		;automatic baud rate detection

;.equ	baud_const, 255		;57600 baud w/ 11.0592 MHz

;.equ	baud_const, 253		;19200 baud w/ 11.0592 MHz
and instead of using "0" change this number to whatever you like - the formula is given above ..
For example, for 9600bps @ 22,1184MHz the number is 244 ..

If you implement any changes you have to compile new HEX file ..

Here, however, it says:
Code:
myPAULM2.hex is intel hex file of "myPAULM2.asm" and "myEXTRA.asm", modified version of PAULMON2 monitor program. The fancy editor was cut and the following functions were added; 
  

1) return address to monitor by using 'JMP monitor' where monitor address was defined in myPAULM2.EQU and, 
2) baud rate was fixed at 9600 8n1, this allows the use of C-52 EVB to be a dedicated controller by using Paul's concept of PROGRAM HEADER w/start-up method and a 32kB NVRAM. PAULMON2 Program Header describes four types of user program. With hardware start-up type and fixed baud rate, user program will run when power up after some initialization.
So, if the rate is fixed to 9600 with 11MHz crystal you will just use 19200bps at the PC end, that's all ..

Rgds,
IanP
 

    Help

    Points: 2
    Helpful Answer Positive Rating
code rom size at89s52

Hi,

I have try to compile the myPAULM2.asm and myEXTRA.asm but have error A9: Syntax Error, A45: Undefined Symbol (PASS-2) and A41: Missing 'END' Statement. I do change on .equ to EQU and add END at end of the code. The error A45 and A41 is solve. How about A9 error? I don't know how to slove it. I'm using Keil V3.51 version. If using asm in Keil do we need any setting on compiler?

May i know this myEXTRA.asm is for us to do debuging on C coding rite?

I have another question. If currently i have some data which is using XBYTE send to SRAM. The data address is start from 0x0000. I would to know after we download the CODE to SRAM the CODE data will overwrite the XBYTE data, am i rite? How can we do the memory mapping for that?

Thank you.

Thank you.
 

battery buffered ram schematics 62256

mupaulm2.txt was compiled with AS31.EXE ..
you can download it from here:
https://www.pjrc.com/tech/8051/
https://www.pjrc.com/tech/8051/tools/as31-sdcc231-pj3-win32.zip

Different assemblers may (and will) generate errors ..
it's just because there are syntax nuances between them ..

I have another question. If currently i have some data which is using XBYTE send to SRAM. The data address is start from 0x0000. I would to know after we download the CODE to SRAM the CODE data will overwrite the XBYTE data, am i rite? How can we do the memory mapping for that?
if SRAM address (0x0000) phisically strats from vector = (0x8000) you can always chang VECTOR and PGM to whatever you like (>8000) and leave some space for data ..
is this what you are trying to do?

rgds,
IanP
 

    Help

    Points: 2
    Helpful Answer Positive Rating
expanded 8051 program rom

Hi Ianp,

Thank you very much. I already downloaded the file which is as31-sdcc231-pj3-win32.rar file in this file i don't see the AS31.EXE. There is the as31 file in the bin. Please can you guide me again..

May i know what is PGM? Let say if i have 1000-Byte's of DATA. So, the CODE VECTOR should start from 9000, am i rite? How can i set the CODE VECTOR? Is there any configuration on compiler? or have to do some modification on the myPAULM2.asm?

Thank you.
 

circuit for 8952 ic burner

There is the as31 file in the bin.
That's the one ..
To use it you will have to go through COMMAND PROMPT (START-ALL PROGRAMS-ACCESSORIES) and mypaul2.txt has to be in the same directory as AS31.EXE
- some DOS experience will be usefull ..

To change destination of YOURPROG.hex you have to modify VECTOR and PGM in mypaulm2.asm ..

Code:
.equ    pgm, 0x8000             ;default location for the user program

rgds,
ianp
 

    Help

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top