sasidharallnew@gmail.com
Newbie level 2
Hi All
i want to compare the data received from RCREG of PIC 16f877a and store it in a array and compare it with the array Which i already declared and take decision accordingly.
Pls find the code below..
The problem is it is only comparing character
eg: Suppose it i type some random data like"gdsgs" i am receiving ss in the output.
Pls help to sort out the issue.
i want to compare the data received from RCREG of PIC 16f877a and store it in a array and compare it with the array Which i already declared and take decision accordingly.
Pls find the code below..
The problem is it is only comparing character
eg: Suppose it i type some random data like"gdsgs" i am receiving ss in the output.
Pls help to sort out the issue.
Code:
#include <pic.h> // Define PIC Registers
#include<htc.h>
#include<string.h>
__CONFIG(0x3f72);
char temp1[]={""};
char temp2[]={"sasi"};
static int count2;
void main()
{
static int count=3; // added for count increment
TRISB=0x01; // Configure RB0 as I/P
TRISC=0b11000000; // Configure PORTC as O/P
RC0=0;
PORTB=0;
INTCON=0x90; // Enable the Global Interrupt & External Interrupt
SPBRG = 129; // the hex value selected from the table
TXSTA = 0b00100110; // determining the settings for the transmitter
RCSTA = 0b10010000; // determining the settings for the receiver
TXREG = 0X0; // initializing the binary value of the transmitted information
TRISA=0x00;
PORTA=0xFF;
TRISD=0x00;
do // beginning of the endless loos from “do” to “while(1)”
{
int strlen1=0;
while (!RCIF);
{
temp1[strlen1]=RCREG;
strlen1++;
}
if(*temp1==*temp2)
{
TXREG=*temp1;
}
int a=strlen1;//sizeof(temp1);
PORTD=a;
RCSTA = 0b10010000; // determining the settings for the receiver
for (int i=0; i< 200; i++); // delay in order to identify the change by looking at the LEDs
}
while(1);
}