background image

Example:   

 

   Provide a reference sample to the user, as shown below, posed for a 

AT89S51 circuit LED experiment, the Port 1 in the AT89S51 eight external 

LED, another-J1 connector, the pins are defined as Vcc, RST, SCK, MOSI, 

MISO, GND.   

A special attention, J1 connector pin is how to connect to AT89S51 the pin: 

RST (Pin 9), MOSI (Pin 6), MISO (Pin 7), SCK (Pin 8).   

   USB multi-Programmer is the use of In-System Programmable (ISP) model 

to programming memory, you must use the MOSI, MISO, SCK, RST, J1 

connector is to be connected to a USB multi-programmer supply 5V power. 

When programming is complete, perform AT89S51, these three pins can be as 

general I / O Pin, absolutely no impact. When the LED test program execution, 

Port 1 of the LED will follow the program set by the order of ON / OFF.   

 

AT89S51 LED test circuit:   

 

 

 

background image

 

 

LED Test Program: 

#include <AT89X52.H>   
void delay_time(unsigned int k); 
//--------------------------------------------------------------- 
//       Main Program 
//-------------------------------------------------------------- 
void main (void)  

   unsigned char i=0x01; 
 
  

while (1) 

 

  { 

 

     P1=i;                // Port 1 output 

           delay_time(50000);   // delay time 
          i=i<<1; 
          if (i==0) 
            i=0x01; 
      } 

//-------------------------------------------------------------- 
//   delay time routine 
//-------------------------------------------------------------- 
void delay_time(unsigned int k) 

    while(k>0) 
      k--;