cheese
Newbie level 4
Hello, I wrote this code for PIC16F887 uC and use Hitech C to compile. There's no error or warning. But the code doesn't work in the right way when i use Style 2. Style 1 is OK. I don't know the reason. Anybody helps me to explain this problem plz!
I attach full code and project for your convenience.
View attachment TestHitechC_err.zip
View attachment main.c.txt
Code:
unsigned char gcan[5] = {0b01110010,0b11011000,0b00011011,0b10010010,0b01101100};
void countdown()
{
const unsigned char position = 0;
unsigned char i, j;
for (i = 0; i <= 7; i++)
{
for (j = 0; j <= 4; j++)
{
//Style 1
//gcan[position + j] = ((gcan[position + j] << 1));
//gcan[position + j] |= 0x01;
//Style 2
gcan[position + j] = ((gcan[position + j]) << 1) | 0x01;
}
}
}
I attach full code and project for your convenience.
View attachment TestHitechC_err.zip
View attachment main.c.txt