I tested the whole functionality of my programmer circuit, and many things work, but some things don't.
It seems to erase the entire contents of an AT89C4051, but it does not successfully program the chip. In fact, it seems nothing is programmed at all.
This is the pseudocode I use for the programmer:
Clear data (Set address 378h to 0) Reset counter and enable program mode and wait 100us (Set Control 37Ah to 6) ** At this point, Pin 1=0V which is expected Raise VPP (Set Control 37Ah to 2) ** Expected 12V at pin 1 but only got 6.8V. Why? I don't know Raise Step Reset (Set Control 37Ah to 3) Wait until system ready Add 10mS delay Lower Step Reset (Set Control 37Ah to 2) Wait until system ready Reset count / lower VPP (Set Control 37Ah to 6)
And for each byte:
Set data (Set Control 378h to data) Wait 100uS Raise Step Reset (Set Control 37Ah to 1) Wait until system ready Wait 2mS lower Step Reset (Set Control 37Ah to 0) Wait until system ready Repeat for remaining bytes
For reference, "raise step reset" means the 4017 IC pin is set to high and "lower step reset" means make reset pin low. Once it falls low, the programming enable will stay low for at least 1/2 the time defined by the 555 timer circuit then it will be raised then after the clock is pulsed then the system will be ready.
Just about everything works but there is
ONE MAJOR ISSUE
When I instructed the system to raise the VPP voltage, it does, but in a weird fashion.
The resistor I use between 12VDC and RST of the micro is 100K only because Atmel's datasheet states that the maximum programming current is 250uA. So by using 100K, I'm using 12VDC/100K=120uA.
So with no microcontroller connected, the operation is accurate. The meter shows very close to 12V. However, when I took a working microcontroller out of a working system and I inserted it into this circuit and measured the voltage after performing the exact same operations, I only get between 6 and 7V.
I looked at other circuits and I haven't seen others use 100K resistors as pull-ups. In fact, I found the pull-up resistor is only 2.7K in the following circuit at: http://www.oocities.org/dinceraydin/8051/index.html
My question is why would such a small resistor be used for programming when the manual clearly states that there is an upper limit to the current that can be provided for VPP?
Am I supposed to violate that spec to make the programmer work?
I searched the Internet and found ANOTHER programmer circuit that uses a LOW VPP resistor (1K).
URL is here: http://students.uta.edu/rx/rxr5243/projects/prog/