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've wrote the following code. I want to output the "Data" bit by bit to Pin1.3,
    with the frequency from interrupt (0) pin.

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

    Here are errors:
    interrupt0417.c(15): error C231: 'dataIN': redefinition
    interrupt0417.c(17): error C129: missing ';' before '<<='

    Anyone can help? Thanks.

Reply
  • I've wrote the following code. I want to output the "Data" bit by bit to Pin1.3,
    with the frequency from interrupt (0) pin.

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

    Here are errors:
    interrupt0417.c(15): error C231: 'dataIN': redefinition
    interrupt0417.c(17): error C129: missing ';' before '<<='

    Anyone can help? Thanks.

Children