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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/25/04 07:28
Read: times


 
#81887 - mistakes fixed but still in a fix
Responding to: ???'s previous message
i have fixed all the mistakes poimted but still code not working
My new modified codes are:

//transmit program
#include<reg51.h>

void Serial_Init(void)
{
SCON=0x50;
EA=1;
ES=1;
TMOD=0x20;
TH1=0xE6;
TR1=1;
}

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

P1=0x00;
P3=0x00;

Serial_Init();

while(1)
{
tchar=P1;
Transmit_Char(tchar);
}
}


//receive program

#include<H:C51AINCLUDEreg51.h>

void Serial_Init(void)
{
SCON=0x50;
EA=1;
ES=1;
TMOD=0x20;
TH1=0xE6;
TR1=1;
}

void call() interrupt 4
{
if(RI)
{
P1=SBUF;
RI=0;
}
if (TI)
TI=0;
}

void main(void)
{
Serial_Init();
while(1){}
}



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