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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/26/04 10:53
Read: times


 
Msg Score: -1
 -1 Answer is Wrong
#82001 - problem solved
Responding to: ???'s previous message
I have modified your program and run it at my system, it works so I think it should work for u also.


//----- Transmit Prg
#inlcude <reg51.h>
void Serial_Init(void)
{
SCON=0x52;
EA=1;
ES=1;
TMOD=0x20;
TH1=0xE6;
TR1=1;
}

void Transmit_Char(unsigned char c)
{
SBUF=c;
while(!TI){} //Waits until transmit
TI=0;
}

void main(void)
{
unsigned char tchar;
P1=0x00;
P3=0x00;
tchar=P1;
Serial_Init();
while(1)
Transmit_Char(tchar); // Here Sends port P1 to serial port
}
// End of Prog




/-------- Receive Prog
#inlcude <reg51.h>
void Serial_Init(void)
{
SCON=0x52;
EA=1;
ES=1;
TMOD=0x20;
TH1=0xE6;
TR1=1;
}


void main(void)
{
Serial_Init();
while(1){
while(!RI);
P1 = SBUF;
RI = 0
}
}

// End of Prog

List of 14 messages in thread
TopicAuthorDate
AT89c51 serial communication problem            01/01/70 00:00      
   Try            01/01/70 00:00      
   While loop in Transmit Char function            01/01/70 00:00      
   mistakes            01/01/70 00:00      
      mistakes fixed but still in a fix            01/01/70 00:00      
         too more fix            01/01/70 00:00      
   Give little more details            01/01/70 00:00      
      more details            01/01/70 00:00      
   problem solved            01/01/70 00:00      
      answer wrong            01/01/70 00:00      
   Yet another problem you must fix.            01/01/70 00:00      
      Hex files needed            01/01/70 00:00      
      Check The serial port            01/01/70 00:00      
         Problem solved            01/01/70 00:00      

Back to Subject List