Page 1 of 1

Variable Bit Error

Posted: Wed Aug 17, 2016 10:22 am
by Osta
Bit variable behaves as a byte....

Re: Variable Bit Error

Posted: Wed Aug 17, 2016 10:36 am
by Osta
I did this device.
The real variable - BYTE !!!

Re: Variable Bit Error

Posted: Wed Aug 17, 2016 10:54 am
by Osta
This program

Re: Variable Bit Error

Posted: Wed Aug 17, 2016 11:18 am
by Benj
Hi Osta,

BoostC did not support bit variables so we simply made a bool equal to a byte.

XC8 does support bit variables so the attached code should solve the problem your having.
PIC_CAL_TypeDefs.c
(2.44 KiB) Downloaded 283 times
The file lives in the "Flowcode 7/CAL/PIC" directory.

Re: Variable Bit Error

Posted: Wed Aug 17, 2016 11:34 am
by Osta
Hi Benj!
Yes! Now it works.
Now it is necessary to add the COF file ..
Regards Slava.

Re: Variable Bit Error

Posted: Wed Aug 17, 2016 2:35 pm
by Benj
Hi Slava,

The PIC XC8 compiler should automatically create the .cof files as part of the compile process.

I've found a bit of a bug concerning the last update and may explain things. Anyway it seems to have broken other parts of the code so I am investigating this now.
(698) bit variables must be global or static
Looks like to use the bool type as a macro parameter it cannot be a bit in the C code for 8-bit PIC. The compiler will likely use a full byte memory location for each bit variable anyway (unless combined into a struct) so even if we are using byte in the C code it should not have any impact on code efficiency.

Here's the original file if you need to go back.
PIC_CAL_TypeDefs.c
(2.52 KiB) Downloaded 256 times

Re: Variable Bit Error

Posted: Wed Aug 17, 2016 3:01 pm
by Osta
Thanks Benj!
I will leave as is, since other functions are working properly.
For example, select the team (if) does not always work correctly.
Regards Slava.