Maverickmax
Advanced Member level 1
Hi
I have been trying to send data to PC via R232 and it works well but it didn't work when I tried to press any letter and I expected my microprocessor to transmit the next letter and it could not work at all. I have used hyperterminal and termv19b and I still get the same effect. could it be my code or what?
Please let me know how to recify this problem
Thank you
Maverick Max
I have been trying to send data to PC via R232 and it works well but it didn't work when I tried to press any letter and I expected my microprocessor to transmit the next letter and it could not work at all. I have used hyperterminal and termv19b and I still get the same effect. could it be my code or what?
Code:
// header files
#include "main.h"
#include "port.h"
#include "delay_loop.h"
//Function Prototypes
void serial_init();
void serial_init()
{
SCON=0x50; //Setup for 8-bit data
TMOD=0x20; //Setup timer 1 for auto-reload
TH1=0xF3; //Setup for 2400 Baud
TR1=1; //Turn on timer 1
TI=1; //Indicate ready to transmit
}
void main(void)
{
char c;
serial_init();
while(1)
{
FIRST_LED=0;
printf("\nEnter a character");
c=getchar();
c++;
printf("The next character is %c",c);
FIRST_LED=1;
Delay_Loop(40);
FIRST_LED=0;
}
}
Please let me know how to recify this problem
Thank you
Maverick Max