sorr for l8 reply been out for a while. i'm using 16f877a. managed to work it out but it take three tries to functions. needs to modify it to respond immediately. here is the code. trying to upload the proteus schematic, no lucK. how to upload proteus schematic here? need help on that one too, sorry.
char lcdtext [3];
unsigned char lcd [3], buf ;
unsigned char buffer[]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ;
void gets(char lcd[]);
char *tc1 = "n1";
char *tc2 ="n2";
void main (){
TRISA =0;
PORTA =0;
Usart_Init (9600);
Lcd_Init (&PORTB);
buf=0;
while (1)
{
if(Usart_Data_Ready ())
{
gets (lcd);
buffer = atoi(lcd);
if (buffer == tc1) { portA.f0 = 1; Lcd_Out(1,1,"on1"); }
else if (buffer ==tc2){ portA.f1 = 1; Lcd_Out(1,1,"on2");}
portA.f0 = ~portA.f0 ;
Usart_Write('Y');
}
}
}
void gets(unsigned char lcd[])
{
char rx_count=0; //counter for character array(string)
char flag=1; //loop status
while(flag==1)
{
if(Usart_Data_Ready()==1)
{
lcd[rx_count]=Usart_Read();
if(lcd[rx_count]==3) flag=0;
rx_count++;
}
}
}
