I have converted a program to XC8 and came across the following problem.
This code,
errors on the while line with something about the types being compared aren't the same.
I wondered if it was assuming a rom pointer and so I changed the assignment to *point = &INDF0; to force it to a ram pointer. This warned of a suspicious pointer conversion - volatile to non volatile!!
I have now changed it back and it compiles fine.
Does anyone know how to tell this stupid compiler what kind of pointer you want?
I must say that first impressions of XC8 are not good.
Edit, forgot, this compiled fine on a 18F14K50 and only errored on a 16F1823.
Edit2, just found in the manual that you should never compare pointers to constants. So, how do I write the above code? It's basically reading the first 128 bytes of RAM.
Mike.
This code,
Code:
void SeedRand(void){
char *point=0;
while((int)point<128){
Seed.bytes.byte3^=*point++;
if(Seed.bytes.byte3&0x80){
Seed.word<<=1;
Seed.word+=1;
}else
Seed.word<<=1;
}
}
I wondered if it was assuming a rom pointer and so I changed the assignment to *point = &INDF0; to force it to a ram pointer. This warned of a suspicious pointer conversion - volatile to non volatile!!
I have now changed it back and it compiles fine.
Does anyone know how to tell this stupid compiler what kind of pointer you want?
I must say that first impressions of XC8 are not good.
Edit, forgot, this compiled fine on a 18F14K50 and only errored on a 16F1823.
Edit2, just found in the manual that you should never compare pointers to constants. So, how do I write the above code? It's basically reading the first 128 bytes of RAM.
Mike.
Last edited: