Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Problem with uploading a hex to AT89C51 in Turbo6 programmer

Status
Not open for further replies.

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
Program error

i tri to upload my hex to at89c51 and ......
i use Turbo 6 programmer and keil C compiller

Can someone to tell me where i'm wrong please
 

pjyc

Junior Member level 1
Joined
May 10, 2001
Messages
17
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
81
Re: Program error

Hi syrax.

If you use evaluation version of keil c51, there is some limitation.

For example, Programs start at offset 0x0800.

And Programs generated with the evaluation software may not be programmed into single-chip devices with less than 2K Bytes of on-chip ROM.

Please check below.

http://www.keil.com/demo/limits.htm

Thanks.
 

sunish

Advanced Member level 4
Joined
Sep 4, 2005
Messages
117
Helped
10
Reputation
20
Reaction score
2
Trophy points
1,298
Activity points
2,359
Re: Program error

hai
you can directly write the programe in keil and debug it very easly.in keil demo version the maximum limit to build a project is 2k. if your program size is small, you can try using assembly language in keil itself. you may be knowing that the hex files created from assembly will be small compared to tht in c. but assembly is a little harder than c.

sunish
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
Error again :((

when i offsen on 00800 it take me a error on adrress 00900
when i use another file downloaded form net it upload it
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
Fail

this is the file
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
Source

when i download a program from chip and upload it there is no problem, when i use TASM compiler , there is no problem , but when i compile with Keil .....:(( it give me error,
Turbo can work with bin file becous when i dowload a program from IC he is in bynary format

Added after 14 minutes:

HERE IS THE SOURCE OF MY PROGRAM
it control some LED's ot Port 3
---------------------------------------------
#include <reg51.h>

int xl = 100;
unsigned int led_table[] = {
0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,
0x40,0x20,0x10,0x8,0x4,0x2,0x1,0x0};

unsigned int led_table2[] = {
0x1,0x3,0x7,0xF,0x1F,0x3F,0x7F,0xFF,
0x7F,0x3F,0x1F,0xF,0x7,0x3,0x1,0x0};

void Init(void);
void delay (void);

void main(void)
{
int aa;
Init();
P1 = 0xf0;
while(1)
{
for(aa=0; aa<16; aa++)
{
P3 = led_table[aa];
delay();
}
for(aa=0; aa<16; aa++)
{
P3 = led_table2[aa];
delay();
}
for(aa=0; aa<20; aa++)
{
P3 = 0x55;
delay();
P3 = 0xaa;
delay();
}

}
}
void SWITCH_Init(void)
{
P3 = 0x00;
P1 = 0x00;
}
//----------------------------------------------
void delay(void)
{
unsigned int x;
for (x = 0; x<= 28000; x++);
}
 

silvio

Advanced Member level 3
Joined
Dec 31, 2001
Messages
716
Helped
105
Reputation
210
Reaction score
16
Trophy points
1,298
Location
Romania
Activity points
11,497
Re: Program error

Syrax,

I ask you to upload the hex file because I suspect some kind of weird format or checksum errors (why always stops at adress 0x0100).
But I found none. The hex file it's OK. Your keil program is compiled starting with 0x0000 and not 0x0800 (evaluation)
I didn't check the C program only the hex file, thus I don't know if will run or not once downloaded into chip.

You said that the programmer is able to program the AT89C51 with whatever hex file downloaded from net and easy cross beyond address 0x0100 when programming AT89C51.
That was the main reason for which you suspect is something wrong with the hex file generated by keil.
Hope my assumptions are correct.

According to your hex file the size of the program is 422 bytes (address 0x0000 - 0x01A5).
The flash memory program of AT89C51 has 4096 bytes (address 0x0000 - 0x0FFF).

Well what I don't understand and I don't say that is the reason for which you're not able to program now the chip, but looking at your picture why turbo6 programmer shows a size file of 1260 bytes (0x04EC)
Same values for chip and buffer.

What means ROM: 30 and Buffer: 34 ?
The programmer is expecting 34 hex according to his buffer and received 30 hex from ROM (AT89C51) thus writing errors ?
But why, because at address 0x0100 in your hex file is data 04 hex.

However try to use the bellow binary file converted from your hex file.

If you already check program starting at offset 0x0800 and programmer stops at 0x0900 then I believe it's not a physical location damaged inside the AT89C51.
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
working file

i try to program from 0800 , but the error come on 0900

Added after 17 minutes:

i upload it but when wrote 00800 the buffer start at 700, and i wrote it drom 00900 and think it's ok
i mus test it and will post the result

Thanks to all

Added after 5 hours 16 minutes:

may th eproblem is in HEADer of file
can some to compile HEX file with pulsing led ot P1.0 /about 1 sec/ for 4MHz Xtall

Added after 17 minutes:

The program tell ot Chip ROM with address 100 is "00", but in the buffer the code is 45, or somethink like this

I download a program from another chip and there the program start fro 00000

Added after 33 minutes:

another working file from I-Net
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
Re: Program error

How can i reduce the RAM memory in C, it take me Error when my Data is up to 11.0->. I use for const "Code" memory , but when put sub routine in 2-3 level

asdasdasd{
asdasdas{
asdasdas{}
}
}

this type incraze my data memory , how can i put validate memory to forgot trouble
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top