The best way to learn programming AT89S52

Hi All
What is the best way to study programming the AT89S52 ?
I'm looking at the below - Atmel 89S52 study Experiment Development Demo
Board - which is also sold on Ebay for around $139 which is a lot of money
but will definately have a good ROI. I don't want to buy the Board if there
is better ways of getting grips of the Assembly language programming code.
I was thining of maybe a software simulator or such which can maybe help -
if something like this exists. There is one on Ebay - PICKIT 1 Demo Board
(6LEDs) Based On PIC 12F629 - which is only for the 12F629. Is there maybe
something like this for the AT89XXX Series ?
There is a lot of PDF's on the internet, but I need something more practical
where I can trial-and-error as I go.
Any feedback much appreciated
Lodewicus Maas
Reply to
Lodewicus Maas
Loading thread data ...
NOTE ==> I added comp.arch.embedded and also set the follow-ups there. The c.a.e group has significantly more traffic that a.m.8, particularly since so many usenet providers have dropped all alt groups.
Atmel's programmer for this part (which can also be used with their AVR chips but see [*]) is the AVRISP-2 (for example, at ) The programmer is run through Atmel's AVR Studio (for their AVR chips).
Other than the chip itself, what else you need kind of depends on what you have laying around. A minimum system would be a breadboard, power supply, and clock plus a few passives.
A 5-volt linear regulator (7805) plus a 9 V battery or unregulated 9 V DC wall wart (plus the usual few passives) is sufficient to power it.
If you need a clock, recommend a canned "clock oscillator" instead of a crystal; they're simpler to interface, fewer quirks. 24 MHz is common; 29.4912 MHz divides nicely for standard serial baud rates.
But you could also go with an RC oscillator.
A recommended "Step 1" is just to toggle a particular I/O pin in an endless loop. This looks simple but to get there requires getting a handle on basic architecture (what needs to be done to initialize?), the chip's registers (how to talk to the I/O pins?), assembling or compiling to loadable code, loading the code, and getting the chip to actually run.
Pseudocode start: initialization stuff outer_loop: toggle I/O pin set counter to 0 inner_loop: add 1 to counter if counter less than loop_max then goto inner_loop: else goto outer_loop:
Step 1.1 would be to toggle the I/O pin again, but this time using one of the chip's built-in timers. Set it to timeout at, say, a 2 Hz rate and toggle the I/O pin every time the timer fires.
start: initialization outer_loop if timer_event then reset timer_event toggle I/O pin goto outer_loop:
timer_interrupt_service_routine: set timer_event
This gets you into how to setup and service an interrupt.
Once you're to that point, everything else is (relatively) easy.
Software simulators are dangerous unless they are 100% cycle-to-cycle identical to the behavior of the silicon. They're kind of useful to help in understanding assembler syntax, stepping through a couple of lines to see if it's what was expected. But for simulating a whole microcontroller? No thanks.
The nice thing about a chip and a breadboard is that you can attach whatever you want to whatever you want (within reason).
For dev boards, the least expensive one out there looks like
which is only US$4.90 (yup, less than 5 bucks). They also have a $7 programmer (real serial port required) and $2 regulator.
[*] Regarding the AVR ISP and 89S52 programming. The AVRISP does work on both but it's complicated by the opposite polarities on the AVRs and 89S52 reset line. If it's used between the two families, it might (at least on the original serial port AVR ISP) not reset properly for the first programming cycle when changing to the 'other' chip family. No worries, just do it again and it should work.
Rich Webb     Norfolk, VA
Reply to
Rich Webb
Thank you Rich - Much Appreciated
Reply to
Lodewicus Maas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.