I am writing a C program to generate Fibonacci numbers until 255 (as 8-bit values) using pic16f887. I try to check the carry bit from STATUS which is bit 0 (LSB) (I checked the datasheet), but all the time is 0.
#include <htc.h>
#define N 20
unsigned char i@0x20;
unsigned char v[N]@0x30;
void main(void)
{
v[0] = 0;
v[1] = 1;
i = 2;
while(1)
{
v[i] = v[i-1] + v[i-2];
if(STATUS &0b00000001)
goto end;
i++;
}
end:
asm("NOP");
}