Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #1 | As a couple of others here, I get Error at address 0000h when trying to program the 2051. I'm using the triad version of the Keil C development suit and it generates the attached hex file. I can b,c,r the chip, and it automatically detects the processor as a 2051. I have verified that the resistor ladder is indeed placed correctly and that vpp is 12 v, so what can the problem be? anyone like to help, please :-) Thanks in advance
Attached Files:
test-c.txt (1.47 KB, 2 views)
test.txt (264 Bytes, 4 views)
|
| Loading... | | |
jolouis Registered: June 24, 2009
Posts: 7
|
|
| |
Reply with quote | #2 | Hi Jarl,
I found that the resistor ladder on my first kit was damaged/defective. I ordered a new kit and after assembly found that it worked perfectly, so I went back to troubleshoot the original kit, having a working board to compare to. In the end I found that for some reason the resistance on the resistor ladder was different, so went to the local electronics parts place and got a new one; desoldered the old one (pain to do), put the new one in (making sure that the dot was facing the top of the board where all the LEDs are), and tried again, and it worked!
I know Frank is usually pretty good at helping out around here (they're his kits after all), but if you're still having issues I can try programming your HEX to one of my chips here just to make sure it's okay... let me know!
Thanks! |
| Loading... | | |
Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #3 | Nope, unfortunatelly. It was ok. 10k as in the schematic, yes it would be really nice if you could check the hex file, but I doubt that is the problem though :-( Thank in regards
|
| Loading... | | |
Frank Moderator
Registered: July 31, 2005
Posts: 1,348
|
|
| |
Reply with quote | #4 | The load addresses of the hex file are outside the range of memory for a 2051. The 2051 has memory from 0000-07FF. The compiler has generated code that loads at address 0800 onwards. This is causing the programmer to 'wrap around' so that address 0000 is being programmed twice - once by the original 0000 data and the second time by the data at address 0800.
Check the device type setting in the Keil compiler. Make sure it is set for Atmel 89C2051. |
| Loading... | | |
Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #5 | If I may ask, (just to learn) how do you see that? Is it the lines starting with: :100800? I also tried to program it with a program that you verified in another thread, same error. But I think the best is to solve this issue first :-) so if you could be so kind as to tell me how I verify that the starting address is 0000h in the program I would be SO greatful
|
| Loading... | | |
Frank Moderator
Registered: July 31, 2005
Posts: 1,348
|
|
| |
Reply with quote | #6 | Your code does have a starting address of 0000h. All that is there is a jump to memory location 0800h which is outside the memory range for a 2051 device.
The hex file is a standard Intel HEX format file. The hex data is represented as ASCII characters, which is why you can open the file using a simple text editor. I have uploaded a description of the file format.
So for the line starting with ":100800", the meaning is as follows:
":" - start of record marker "10" - data byte count "0800" - load address
Attached Files:
Intel_HEX_format.pdf (4.98 KB, 2 views)
|
| Loading... | | |
Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #7 | Fantastic. Thanks, I guess it is because I'm using a non licensed version of Keil.
I find it difficult to locate a relativelly cheap compiler for -51 controlers. Going to look at sc51 though. Anyone that could recomend a compiler are more than welcome :-)
Thanks for your help so far. It's really amazing the help I got here thanks to you all !!!
|
| Loading... | | |
Frank Moderator
Registered: July 31, 2005
Posts: 1,348
|
|
| |
Reply with quote | #8 | You should be able to change the device type in Keil.
Click on 'Project - Options for Target' then click on the 'Device' tab. Under 'Atmel' select 'AT89C2051'.
Click on the 'Target' tab and make sure 'Use On-chip ROM' is ticked.
This will force the compiler to generate code that fits on the 2051's address space.
|
| Loading... | | |
Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #9 | Yeah, well. It's a bit embarrasing... I use the non licensed version which does not allow targeting below 8000h :-) So I guess the main issue is solved :-) Now all I need is to find a suit that works but does not cost as much as Keil, I do not have $3300 to spend on this :-( |
| Loading... | | |
Frank Moderator
Registered: July 31, 2005
Posts: 1,348
| |
Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #11 | Thanks this is amazing. I use OpenSuse on daily basis, so I just used oneclick, waited for 2 minutes, and voila, up and running.
I can now program and verify the code, så I guess its working :-)
Thanks a lot.
|
| Loading... | | |
Jarl Registered: Nov 05, 2009
Posts: 7
|
|
| |
Reply with quote | #12 | Wow. SDCC actually works:-) But what would the best arguments be? The at89c2051 hs a very limited space and the code that sdcc generates quickly becomes rather big. I guess I could set some of the many parameters to optimize it to the atmel? |
| Loading... | | |
Frank Moderator
Registered: July 31, 2005
Posts: 1,348
| |
jolouis Registered: June 24, 2009
Posts: 7
|
|
| |
Reply with quote | #14 | Glad to hear you got it sorted out Jarl! Sorry I got very sick last week and couldn't even look at the computer screen until yesterday so I never got a chance to check your code, but Frank's taken care of it obviously! I use SDCC for all my projects, it really is an awesome way to go (why on earth do others try to make this so difficult/expensive?). Anyways not sure about optimizations but if you do find any let me know because there's definitely a significant size difference between keil compiled hex and SDCC... |
| Loading... | | |