Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/08 19:01
Modified:
  08/20/08 19:45

Read: times


 
#157591 - Back to Topic-here is what I tried for days..
Responding to: ???'s previous message
I tried the Asim Khan's circuit for AT89S51. The software said no response from uC. I read the datasheet and made my own circuit on bread board. Here is the schematics(drawn in paint)and the code Visual C++ 2005. plz see and give your suggestion :)


( http://img388.imageshack.us/img388/6940/at89s51gc8.jpg )

Code:
void delay(DWORD nTimeMs)
{
	MSG msg;
    DWORD endTick;
    endTick = GetTickCount() + nTimeMs;
    while(GetTickCount() < endTick)
    {
    	if(PeekMessage(&msg, NULL, 0, 0, TRUE))
        {
          	TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
	}
	return;
}

BYTE WriteRead(DWORD Bits, int TClck = 1);

BYTE WriteRead(DWORD Bits, int TClck)
{
	char		ByteToSend	= NULL		;
	//DWORD		Bits		= 0xAC530000;
	char		BitCount	= 0			;
	const DWORD One			= 1			;
	BYTE		DataIn		= NULL		;
	BYTE		DataRec		= NULL		;
	//char		str[100];
	for(BitCount=31;BitCount>=0;BitCount--)
	{
		ByteToSend = ((One<<BitCount) & Bits)?1:0;	// Get Current Bit
		ByteToSend <<= 3;							// Shift Current Bit to data.3 = pin 5
		Out32(888,ByteToSend);
		ByteToSend |= 16;							// Turn On CLOCK IN. Data.4 is pin 6.
		Out32(888,ByteToSend);
		delay(TClck);									// 1 ms delay
		if(BitCount<=7)
		{
			DataIn = Inp32(889);					//Read From Status Register
			DataIn &= 64;
			DataRec <<= 1;
			if(DataIn)
				DataRec |=1;
		}
		ByteToSend &= 0xEF;							// Brink down CLOCK IN
		Out32(888,ByteToSend);
		delay(TClck);
	}
	return DataRec;
}

void Write(DWORD Bits, int TClck = 1);

void Write(DWORD Bits, int TClck)
{
	char		ByteToSend	= NULL		;
	//DWORD		Bits		= 0xAC530000;
	char		BitCount	= 0			;
	const DWORD One			= 1			;
	//BYTE		DataIn		= NULL		;
	//BYTE		DataRec		= NULL		;
	//char		str[100];
	for(BitCount=31;BitCount>=0;BitCount--)
	{
		ByteToSend = ((One<<BitCount) & Bits)?1:0;	// Get Current Bit
		ByteToSend <<= 3;							// Shift Current Bit to data.3 = pin 5
		Out32(888,ByteToSend);
		ByteToSend |= 16;							// Turn On CLOCK IN. Data.4 is pin 6.
		Out32(888,ByteToSend);
		delay(TClck);									// 1 ms delay
		ByteToSend &= 0xEF;							// Brink down CLOCK IN
		Out32(888,ByteToSend);
		delay(TClck);
	}
}

void CMy8051Dlg::OnBnClickedButton2()
{
	WriteRead(0xAC530000);
	Write(0xAC800000);
	Write(0x400000AA);
	BYTE dat = WriteRead(0x20000000);
	char str[20];
	sprintf_s(str,20,"%x",dat);
	MessageBox(str);
	
}



There was no output at MISO during the sending of 4th byte of Programming Enable.I checked for correctness of output signals(sck and MOSI) at lpt using an LED (with 500 ms delay). It blinked fine.My LPT is 5.02V, checked with multimeter. I have Mellinium Motherboard and 2.02Ghz P4 processor (GenuineIntel).

I even tried the ACE-electronics SW(i just had to change the connection at lpt pins according their signal pins) but programming did not happen.

Pls tell me where something is wrong? esp with the circuit?

List of 34 messages in thread
TopicAuthorDate
Programming 8051/8052            01/01/70 00:00      
   Get something ready to do to start...            01/01/70 00:00      
   here's a simple ISP cable for 89S51/2            01/01/70 00:00      
      ... and HOPE            01/01/70 00:00      
    or DS89C450            01/01/70 00:00      
      Not the fastest by 3::1            01/01/70 00:00      
         There are features ...            01/01/70 00:00      
            Pray explain            01/01/70 00:00      
               Some features really DO help            01/01/70 00:00      
                  why fiddle with MODE 0            01/01/70 00:00      
                     There aren't many reasons, but SPI isn't one            01/01/70 00:00      
                        you are describing SPI            01/01/70 00:00      
                           Have a look!            01/01/70 00:00      
                              luvverly !            01/01/70 00:00      
                                 ... and what I really like ...            01/01/70 00:00      
                                    nope            01/01/70 00:00      
                                       You missed a thing or two, Erik            01/01/70 00:00      
    i edit my answer as            01/01/70 00:00      
   AT89S5X or DS89C450MNG            01/01/70 00:00      
   Back to Topic-here is what I tried for days..            01/01/70 00:00      
      two mistakes            01/01/70 00:00      
      Logic Low Levels?            01/01/70 00:00      
      please consider            01/01/70 00:00      
         Abt ISP cable ang voltage level            01/01/70 00:00      
            That how most of these posts go            01/01/70 00:00      
               schematics at last!            01/01/70 00:00      
                  no, the frequency does not matter            01/01/70 00:00      
            Maybe a helpful link            01/01/70 00:00      
            Where you measure the voltage makes a difference            01/01/70 00:00      
               ISP Schematics at last!            01/01/70 00:00      
                  Keep your work clean and wires short            01/01/70 00:00      
                  See if this suits you...            01/01/70 00:00      
      EA pin should be high            01/01/70 00:00      
         EA high not necessary during ISP            01/01/70 00:00      

Back to Subject List