bbgil
Full Member level 2

vb6 usart
I have this program which i want to modify to control LED and reset the PIC via USART and VB6. i added some modifcation to allow LED on when it receive any data from USART. The code display text to an LCD. simulated this in proteus and i used virtual serial port driver. I need help to detect command or text output from keyboard to control LED. Here is the code. any help is appreciated.
unsigned short pos, i;
char lcdtext [41];
void main (){
TRISA =0;
PORTA =0;
Usart_Init (9600);
Lcd_Init (&PORTB);
i=0;
while (1)
{
if(Usart_Data_Ready ())
{
lcdtext = Usart_Read ();
i++;
if (i==40)
{PORTA.f0 =1;
PORTA.f1 = 1;
i=0;
Lcd_Cmd (LCD_RETURN_HOME);
for (pos=0;pos<40;pos++ )
{
Lcd_Chr_CP (lcdtext[pos]);
if (pos==16) Lcd_Cmd (LCD_SECOND_ROW);
}
Usart_Write('Y');
}
}
}
}
I have this program which i want to modify to control LED and reset the PIC via USART and VB6. i added some modifcation to allow LED on when it receive any data from USART. The code display text to an LCD. simulated this in proteus and i used virtual serial port driver. I need help to detect command or text output from keyboard to control LED. Here is the code. any help is appreciated.
unsigned short pos, i;
char lcdtext [41];
void main (){
TRISA =0;
PORTA =0;
Usart_Init (9600);
Lcd_Init (&PORTB);
i=0;
while (1)
{
if(Usart_Data_Ready ())
{
lcdtext = Usart_Read ();
i++;
if (i==40)
{PORTA.f0 =1;
PORTA.f1 = 1;
i=0;
Lcd_Cmd (LCD_RETURN_HOME);
for (pos=0;pos<40;pos++ )
{
Lcd_Chr_CP (lcdtext[pos]);
if (pos==16) Lcd_Cmd (LCD_SECOND_ROW);
}
Usart_Write('Y');
}
}
}
}