This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

AT89S52 external clock

Hi,

I'd like to output my data stored in an array in MCU AT89S52 by a frequency 1MHz,
which means output a series data bit by bit every 1/1M second.

How can I generate a 1M clock or input a 1M clock?
Hoe can I output the data bit by bit every 1/1M second?

Any suggestion for these by C51 uvision4 compiler?

Thanks.

Parents
  • I'v fixed my code. There's no error now, but the result isn't right.

    NO data has outputed from Pin1.3

    Anything wrong here?

    #include <AT89X52.H>
    #include <stdio.H>
    
    
    sbit dataIN = P1^3;      //Output
    
    
    volatile char Data = 0xAA;
    
    void ex0_isr(void) interrupt 0
    {
          if ((Data & 0x80) == 0)
                dataIN = 0;
              else
                    dataIN = 1;
    
              Data<<=1;
    }
    
    
    
    void main()
    {
      IT0 = 1;   //  falling edge on /INT0 (P3.2)
      EX0 = 1;   //  Enable EX0 Interrupt
      EA = 1;        // Enable Global Interrupt Flag
    
    
    }
    

Reply
  • I'v fixed my code. There's no error now, but the result isn't right.

    NO data has outputed from Pin1.3

    Anything wrong here?

    #include <AT89X52.H>
    #include <stdio.H>
    
    
    sbit dataIN = P1^3;      //Output
    
    
    volatile char Data = 0xAA;
    
    void ex0_isr(void) interrupt 0
    {
          if ((Data & 0x80) == 0)
                dataIN = 0;
              else
                    dataIN = 1;
    
              Data<<=1;
    }
    
    
    
    void main()
    {
      IT0 = 1;   //  falling edge on /INT0 (P3.2)
      EX0 = 1;   //  Enable EX0 Interrupt
      EA = 1;        // Enable Global Interrupt Flag
    
    
    }
    

Children