Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/13/07 19:20
Read: times


 
#132820 - Serial hung.
Responding to: ???'s previous message
Hello, I have a problem of serial communication of a microcontroller AT89S52 and a visual application, the problem it is that in random form it is hung and the communication with the application is lost I have proven recharging the parametros before each communication is not equal is hung suddenly without being able to identify the reason, the unica form to recover the communication reseteando the card and works well. Data: I am using a converter of USB to Serial for coneccion to the PC.

Thanks.


#include <Reg52.h>
#include <stdio.h>
char uart_data;
void Entrada1();
void Entrada2();
void Salida1();
void Salida2();
void time1();
void iniserial();
sbit s1 = P2^0;
sbit s2 = P2^1;
sbit s3 = P2^2;
sbit s4 = P2^3;
long int E1;
long int S1;
long int E2;
long int S2;
long int t1;
long int t2;

void main(void)
{

#ifndef MONITOR51
SCON = 0x52;
TMOD |= 0x20;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
ES = 1;
EA = 1;

#endif

printf ("\n0,0,0");

while(1);
}
void serial_IT(void) interrupt 4
{
if (RI==1)
{
RI = 0;
uart_data = SBUF;
if(uart_data==0x30)
{
E1 = 0;
E2 = 0;
S1 = 0;
S2 = 0;
printf ("\n0,0,0");
}
}

if(s1==0)
{ while(s2==1);
while(s1==0 || s2==0);
Entrada1();
}

if(s2==0)
{ while(s1==1);
while(s1==0 || s2==0);
Salida1();
}

if(s3==0)
{ while(s4==1);
while(s3==0 || s4==0);
Entrada2();
}

if(s4==0)
{ while(s3==1);
while(s3==0 || s4==0);
Salida2();

}
}




void Entrada1(void)
{ E1++;
time1();
iniserial();
printf ("\n1,1,%li",E1);
if (s1==0);
s1 = 1;
if (s2==0);
s2 = 1;
}
void Salida1(void)
{ S1++;
time1();
iniserial();
printf ("\n1,2,%li",S1);
if (s1==0);
s1 = 1;
if (s2==0);
s2 = 1;
}
void Entrada2(void)
{ E2++;
time1();
iniserial();
printf ("\n2,1,%li",E2);
if (s3==0);
s3 = 1;
if (s4==0);
s4 = 1;
}
void Salida2(void)
{ S2++;
time1();
iniserial();
printf ("\n2,2,%li",S2);
if (s3==0);
s3 = 1;
if (s4==0);
s4 = 1;
}
void time1(void)
{
for(t1 = 0; t1<=10000; t1++);
}

void iniserial(void)
{
#ifndef MONITOR51
SCON = 0x52;
TMOD |= 0x20;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
TI = 1;
ES = 1;
EA = 1;
#endif
}

List of 83 messages in thread
TopicAuthorDate
Comments about AT89S8253            01/01/70 00:00      
   are you surprised, it's Atmel            01/01/70 00:00      
      are you surprised, it's Erik            01/01/70 00:00      
   Not neccessarily bugs...            01/01/70 00:00      
      AT89S8253 ALE pulses            01/01/70 00:00      
         Yes, a bit imprecise            01/01/70 00:00      
            And Vcc rise time...            01/01/70 00:00      
               What kind of "external reset"?            01/01/70 00:00      
      not that fast, Kai            01/01/70 00:00      
         Not so fast, Jan...            01/01/70 00:00      
            speaking from experience...            01/01/70 00:00      
               ...as engineer?            01/01/70 00:00      
               make that darn datasheet 5000 pages            01/01/70 00:00      
                  Exactly!            01/01/70 00:00      
                     I'm not sure what you mean, Kai            01/01/70 00:00      
                        That's what I meant            01/01/70 00:00      
                  Serial hung.            01/01/70 00:00      
            migration            01/01/70 00:00      
               Please quote carefully...            01/01/70 00:00      
         is it possible            01/01/70 00:00      
            I don't think so...            01/01/70 00:00      
   Any reset            01/01/70 00:00      
      I've wondered about this ...            01/01/70 00:00      
         Indeed!            01/01/70 00:00      
            Perhaps they're part of the problem ...            01/01/70 00:00      
               Do you think...            01/01/70 00:00      
                  That's not clear to me.            01/01/70 00:00      
               not here            01/01/70 00:00      
                  These are all COTS SMPS\'            01/01/70 00:00      
                     startup            01/01/70 00:00      
            Is it not instead a problem of letting reset go be            01/01/70 00:00      
               staring problem            01/01/70 00:00      
                  have you never stared at a problem :)            01/01/70 00:00      
                     Ah, so you meant....            01/01/70 00:00      
      What resets?            01/01/70 00:00      
         Any reset!            01/01/70 00:00      
            I got what you mean            01/01/70 00:00      
               Circuit proposed            01/01/70 00:00      
                  Interesting!            01/01/70 00:00      
         SMPS and LC filter            01/01/70 00:00      
            Switchers & low ESR            01/01/70 00:00      
               you missed the point            01/01/70 00:00      
                  What 100nF?            01/01/70 00:00      
            Rob is right            01/01/70 00:00      
               Ah            01/01/70 00:00      
                  Erik, you do use switchers frequently...            01/01/70 00:00      
                     nope, all I know is that they work and work and wo            01/01/70 00:00      
                        Thanks            01/01/70 00:00      
                           so ... Kai ... how would YOU build a power switch?            01/01/70 00:00      
                              there is no difference between "no power" and "in            01/01/70 00:00      
                                 There is a difference ... no power means no clock            01/01/70 00:00      
                                    ah, an investigatory measure            01/01/70 00:00      
                                       The Max1232 gets pretty confused ...            01/01/70 00:00      
                                          what decoupling do you have across the supervisor            01/01/70 00:00      
                                             This was a Philips ...            01/01/70 00:00      
                                                Too fast?            01/01/70 00:00      
                                                   The risetime isn\'t all that fast.            01/01/70 00:00      
                                          More details, please?            01/01/70 00:00      
                                             So far, it's just the reset that's been broken            01/01/70 00:00      
                                                Throw away the DS1232!!            01/01/70 00:00      
                                                   I\'ll have to send for a couple ...            01/01/70 00:00      
                                                      I've seen that one and it did not work            01/01/70 00:00      
                                                         Especially difficult to design            01/01/70 00:00      
                                                      Datasheets            01/01/70 00:00      
                                                      610msec reset active time of MAX1232 not enough?            01/01/70 00:00      
                                                         Let's get to the bottom of it ...            01/01/70 00:00      
                                                            Some ideas...            01/01/70 00:00      
                                                               each flash/eeprom HAS a charge pump...            01/01/70 00:00      
                                                                  Exactly, Jan!            01/01/70 00:00      
                                                               Yes, but ...            01/01/70 00:00      
                                                                  Why there are reset issues            01/01/70 00:00      
                                                                     so you're saying I should pull down ALE and nPSEN            01/01/70 00:00      
                                                                        Real Reset            01/01/70 00:00      
                                                                     be careful...            01/01/70 00:00      
                                                                     never heard of that one, can you elaborate            01/01/70 00:00      
                                                                        Elaborations on Reset            01/01/70 00:00      
                                                                           Mayabe that's worth some study ...            01/01/70 00:00      
                                                                              Which chip are you using?            01/01/70 00:00      
                                                                                 I can try several, but for now, Philips            01/01/70 00:00      
                                                   DS1232?            01/01/70 00:00      
                                                      it means Dallas Semiconductor            01/01/70 00:00      
                                                   re 1232            01/01/70 00:00      
   Sorry.            01/01/70 00:00      

Back to Subject List