Professional Documents
Culture Documents
Code
Code
You can post your code and results which would be more interesting that just saying it worked.
E
emufambirwi
Member
Sep 28, 2018
#6
Diver300 said:
You can post your code and results which would be more interesting that just saying it worked.
Here it is
C:
char incchar;
char incoming[80];
char *result; // command string search result
int i = 0;
void main() {
PORTB = 0;
TRISB = 0; //RB0 input for interrupt
PORTD = 0;
TRISD = 0; //PORTD all output
ANCON0 = 0x00; // Configure PORTC pins as digital
ANCON1 = 0x00; // Configure PORTC pins as digital
ANCON2 = 0x00; // Configure PORTC pins as digital
{
PORTB.F0 = 0x01;
PORTB.F1 =0x01;
}
if (result = strstr (incoming, "OFF")); // search for string "OFF" in incoming and save it in result
if (memcmp("OFF", result, 3) == 0)
{
PORTB.F0 =0x00;
PORTB.F1 =0x00;
}
}
}
}