Hi , I want to use external interrupts of 89C51 to receive/transmit data using sync modem. Following is the C code i have written but that is not working.I'm using evaluation version of Keil Compiler . I have following doubts about ISR in C 1. Do we need to enable and disable the interrupt in its ISR to prohibit it to interrupt unless its ISR is over. 2. It it necessary to specify the register bank ( using 1 ..... etc ) 3. To set serial port baud rate do we need to set TCON regs , default C51 setting is sufficient or not. 4. Do I need to modify startup.a51 file for this code. Can anybody suggest me any other way to control sync modem ( source code or any url ) ? thaks Sanjay
/*;Program to Transmit data to GMSK CMX469 Modem ;Int0 -> Applied RxSync clock used for data sending P3.2 ;Int1 -> Applied Txsync clock used for data receiving P3.3 ;P1.0 -> Tx data ;P1.1 -> Rx data ;P1.2 -> Carrier Detect */ #include <reg51.h> #include <stdio.h> //void ReceiveData(void); //to be called by interrupt ISR //void TransmitData(void); //to be called by interrupt ISR void InitializeInterrupts(void); void InitSerialPort(void); static void INT0_ISR (void); //RX Sync clock static void INT1_ISR (void); //TX sync clock void main() { InitSerialPort(); InitializeInterrupts(); while(1) { P0=0xff; P2=0xff; } } static void INT1_ISR (void) interrupt 2 using 1 //for tx { EX1=0; //disable int1 P2=0x00; // making it zero to know whether intr has ocured on falling edge // TransmitData(); //function to tranmit data EX1=1; //enable int1 } static void INT0_ISR (void) interrupt 0 using 1 //for receive { EX0=0; //disable int0 P0=0x00; // making it zero to know whether intr has ocured on falling edge //ReceiveData(); //function to receive data EX0=1; //enable int0 } void InitializeInterrupts(void) { EX0=1; IT0=1; //falling edge EX1=1; IT1=1; //falling edge EA=1; } void InitSerialPort(void) { SCON = 0x52; /* SCON */ /* setup serial port control */ TMOD = 0x20; /* TMOD */ /* hardware (9600 BAUD @12MHZ) */ TCON = 0x69; /* TCON */ TH1 = 0xfd; /* TH1 */ //9600 baud rate TR1=1; printf("\nModem Program is running\n"); }
Cambridge university research I cdnuolt blveiee taht I cluod uesdnatnrd waht I was rdgnieg TEH PAOMNNEHAL PWEOR OF THE HMUAN MNID Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, teh olny iprmoatnt tihng is taht teh frist adn lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mind deosn't raed ervey lteter by istlef, but the wrod as a wlohe. Amzanighuh ? Truly amazing...but please avoid using sms language when you are interacting in a forum. Rgds Raj
"it deosn't mttaer in waht oredr the ltteers in a wrod are, teh olny iprmoatnt tihng is taht teh frist adn lsat ltteer be in the rghit pclae."
trbl w sms is tht ltrs rnt evn all there!