turning LEDs ON and OFF of PIC microcontroller by reading data from putty

Pic's picture
Pic

Offline

Joined: Feb 05, 2019

Replies: 1
turning LEDs ON and OFF of PIC microcontroller by reading data from putty
February 5, 2019 - 1:04am

If "A" is typed in putty, then LED0 of the PIC24FJ128GA010 turns ON. If "99" is ented in putty or any other terminal program, LED1 blinks. Any idea how to do that ?

 

Aswinth Raj's picture

Offline

Joined: Aug 16, 2016

Replies: 836
use USART module on PIC
February 5, 2019 - 4:47pm

In your case the PIC and computer should have been connected through Serial communication.

Putty is a serial software using which you can send serial data from compter to PIC thorugh COM port.

So all you have to do is write a program on PIC to check for any incoming serial data and based on that you have to control the LED

Pic's picture
Pic

Offline

Joined: Feb 05, 2019

Replies: 1
I am using this to receive
February 6, 2019 - 12:56am

I am using this to receive the character entered in putty. But its not working. I am using PIC24FJ128GA010.

void U2_RxByte(void)
{
    while(!(U2STAbits.URXDA));
    if(!(U2STAbits.OERR))
    {
        command = U2RXREG;
        delayFunc();
    }
}