??? 11/07/06 23:05 Read: times Msg Score: -2 -2 Message Not Useful |
#127522 - Interrup Serial |
Hello, I am trying to receive a character that resetee a record and it does not work, use keil.
This is the code. #include <Reg52.h> // se incluyen archivos externos #include <stdio.h> char uart_data=0x30; void Entrada(); void Salida(); sbit s1 = P2^0; sbit s2 = P2^1; sbit s3 = P0^0; char R1; long int E=0x00; long int S=0x00; void main(void) { #ifndef MONITOR51 SCON = 0x52; TMOD |= 0x20; TH1 = 0xFD; TL1 = 0xFD; TR1 = 1; TI = 1; ES = 1; EA = 1; #endif while(1); void serial_IT(void) interrupt 4 { if (RI==1) { RI = 0; uart_data = SBUF; if(uart_data==0x00) E = 0; TI = 1; SBUF = uart_data; } else TI = 1; if(s1==0) { while(s2==1); if(s3==1)Entrada(); while(s1==0 || s2==0); } if(s2==0) { while(s1==1); if(s3==0)Salida(); while(s1==0 || s2==0); } } void Entrada(void) { E++; printf ("\n%10li",E); } void Salida(void) { S++; printf ("\n%10li",S); } Helpme please. Thanks |
Topic | Author | Date |
Interrup Serial | 01/01/70 00:00 | |
Duplicate post![]() | 01/01/70 00:00 |