about serial communication!

I can't step over this instruction ( while(TI==0);//  )
the program :

#include "reg51.h"
main()
{
  TCON = 0x50;
  TMOD = 0x20;
  TL1 = 0xFD;
  TH1 = 0xFD;
  TR1 = 1;
  while(1)
  {
   SBUF = 0xFF;
   while(TI==0);//  I can't step over here .
   TI = 0;
  }
  

Parents
  • Sorry, but I do not see where you initialized the SCON (and T2CON if it is presents) register(s)? May it be possible that T2 configured as baud rate generator but does not run?
    As well there are not shown interrupts settings, do you use ISR of T0 and T1?
    Another note about your example is that

    TCON = 0x50;
    has already run timers T0 and T1 via set bits TR0 and TR1.

Reply
  • Sorry, but I do not see where you initialized the SCON (and T2CON if it is presents) register(s)? May it be possible that T2 configured as baud rate generator but does not run?
    As well there are not shown interrupts settings, do you use ISR of T0 and T1?
    Another note about your example is that

    TCON = 0x50;
    has already run timers T0 and T1 via set bits TR0 and TR1.

Children
More questions in this forum