LED control vis USART and VB6

Status
Not open for further replies.

bbgil

Full Member level 2
Joined
Mar 11, 2006
Messages
135
Helped
13
Reputation
26
Reaction score
9
Trophy points
1,298
Activity points
2,321
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');
}
}
}
}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…