From: Helton M. <hm...@ya...> - 2003-01-28 19:25:35
|
Hello Everybody I have a incoompreensive error, please tell me were stay the error: The Code: #include <at89x52.h> // Global Variables =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D data unsigned char rx_buffer[16]; data unsigned char tx_buffer[16]; data unsigned char ptRx; data unsigned char ptTx; data unsigned char ptTxInsert; bit RxDataFlg; void Serial_ISR(void) interrupt 4 using 1 { ES =3D 0; if (RI){ RI =3D 0; rx_buffer[ptRx++] =3D SBUF; if (ptRx >=3D 16) ptRx =3D 0; RxDataFlg =3D 1; }=09 if (TI){ TI =3D 0; SBUF =3D tx_buffer[ptTx++]; if (ptTx >=3D 16) ptTx =3D 0; } ES =3D 1; } void putchar(unsigned char value) { tx_buffer[ptTxInsert++] =3D value; if (ptTxInsert >=3D BUFFER_SIZE) ptTXInsert =3D 0; TI =3D 1: } void init() { SCON =3D 0x50; TCON =3D 0x40; TMOD =3D 0x21; TR0 =3D 1; TR1 =3D 0; TH1 =3D 0xFD; // 9600 bps to 11 MHz. TH0 =3D 0xDC; TL0 =3D 0; TR1 =3D 1; REN =3D 1; RI =3D 0; IP =3D 0; IE =3D 0x96; ptRx =3D 0; RxDataFlg =3D 0; ptTxInsert =3D 0; } void main (void) { init(); while(1) { if (RxDataFlg) { RxDataFlg =3D 0; putchar(12); } =09 } } // The result a infinit transmit to Serial Port (012-012-012-012...) But i can't find the error... Please Help Me !!! Thanks --------------------------- Helton Luiz Marques T=E9cnico Sistemas de Automa=E7=E3o Elcotech - Divis=E3o de Tecnologia - elc...@el... Elco Engenharia - www.elco.eng.br Fone:+55(41)213-3300 Cel: +55(41)9121-1583 _______________________________________________________________________ Busca Yahoo! O serviço de busca mais completo da Internet. O que você pensar o Yahoo! encontra. http://br.busca.yahoo.com/ |