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.
What yuve godda do is determine wever v chip suports it. If it cn then u can use c51 to write code 2 enable it.
Capushta?
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.
This is a wind up. Right?
Yes. I wonder why those codes can't work. Thanks a lot!
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 }
http://www.keil.com/forum/62462