so, what changes to do ?/
void should be removed?
void should be removed?
For some reason I was thinking that "void xxx(void);" and "void xxx(void){.....}" were both prototypes.The function prototype should not be omitted. Compilers are known to do pretty sketchy things when there is no prototype, best case, it assumes an int return type. Omitting it will probably cause a warning for the PIC compiler...
This should be left in.
if(RCREG=='b');
{
f = 'a' ;
HSerout(f);
__delay_ms(250);
}
yes semicolon was problem...ut the problem was that you had a semicolon after the "if(RCREG == 'b')"
Yes, that is correct. That while statement essentially says that the program must wait until !TXIF is 0, so when TXIF becomes 1, the statement becomes 0, and it will break out of that loop and continue with the code.I am little bit confused..
while(1) mean loop forever,
but while(!TXIF); // Wait for module to finish
not clear to me ! 'NOT' so, if TXIF is 0 it will 1, like that?
while(TXIF==0);
while(1) // endless Loop
{
ch='a';
HSerout(ch);//for testing uart is working
for(char t=0;t<6;t++){
c[t]= HSerin();
}
for(char t=0;t<5;t++) {
ch=c[t];
HSerout(ch); //sending back the data
}
}
while(1) // endless Loop
{
ch='a';
HSerout(ch);//for testing uart is working
for(char t=0;t<6;t++){
*c++= HSerin();
}
for(char t=0;t<5;t++) {
ch=*c++;
HSerout(ch); //sending back the data
}
}
for(char t=0;t<5;t++) {
ch=*c++;
HSerout(ch); //sending back the data
}
#define ESC 27
unsigned char *a=" Hello! Ask me a question!\n ";
unsigned char *w=" WRONG PASSWORD ";
unsigned char *m=" MATCHED PASSWORD ";
unsigned char b[10];
unsigned char *c="Hello";
unsigned char HSerin(void);
void HSerout(unsigned char ch),
HSerinit(void);
void main(void) // program entry
{
int compareLimit = 100;
TRISB=0x00;
unsigned char ch ; // <- LOOK HERE.
ADCON1 = 0x6; // Analogue off
HSerinit();
__delay_ms(1);
while(*a!=0)
{
ch=*a++;
HSerout(ch);
__delay_ms(150);
}
while(1) // endless Loop
{
for(char x=0;x<9;x++){
b[x]=HSerin();
if(b[x]== ESC){
b[x]=0;
break;
}
}
int result = strncmp(c,b, compareLimit);
if(result > 0 || result < 0){
while(*w!=0)
{
ch=*w++;
HSerout(ch);
__delay_ms(150);
}
}
else if(result==0)
{
while(*m!=0)
{
ch=*m++;
HSerout(ch);
__delay_ms(150);
}
}
}
}
I am very happy to hear that. Congratulations!I am just telling, problem solved......