katsmiley
Newbie level 4
serial communication
hey guys plz help me out.....here i have done program for serial transmition..i am using keil compiler...my problem is i can not see string"ATKT" in the serial window.i am sending it char by char using putchar ....whai is wrong inthis??plz help..........
#include<stdio.h>
#include <REG51.H>
void send(unsigned char []);
void delay();
void serialint(void);
unsigned char prati[]="ATKT";
void main()
{
serialint();
while(1)
{
send(prati);
delay();
}
}
void serialint(void)
{
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x21; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0xf3; /* TH1: reload value for 2400 baud */
TR1 = 1; /* TR1: timer 1 run */
TI = 1;
}
void delay(void)
{
TH0=0XEE;
TL0=0XE0;
TR0=1;
while(!TF0);
TF0=0;
}
void send(unsigned char *p)
{
int val=0;
while(*p!='\n')
{
val=*p;
putchar(val);
delay();
p++;
}
}
hey guys plz help me out.....here i have done program for serial transmition..i am using keil compiler...my problem is i can not see string"ATKT" in the serial window.i am sending it char by char using putchar ....whai is wrong inthis??plz help..........
#include<stdio.h>
#include <REG51.H>
void send(unsigned char []);
void delay();
void serialint(void);
unsigned char prati[]="ATKT";
void main()
{
serialint();
while(1)
{
send(prati);
delay();
}
}
void serialint(void)
{
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x21; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0xf3; /* TH1: reload value for 2400 baud */
TR1 = 1; /* TR1: timer 1 run */
TI = 1;
}
void delay(void)
{
TH0=0XEE;
TL0=0XE0;
TR0=1;
while(!TF0);
TF0=0;
}
void send(unsigned char *p)
{
int val=0;
while(*p!='\n')
{
val=*p;
putchar(val);
delay();
p++;
}
}