Variable Bit Error

A forums to allow resolved bugs and problems with Flowcode v7 to be stored and marked as resolved.

Moderator: Benj

Post Reply
User avatar
Osta
Posts: 159
Joined: Tue Jul 05, 2016 9:42 am
Been thanked: 13 times
Contact:

Variable Bit Error

Post by Osta »

Bit variable behaves as a byte....
Attachments
I declare a variable of 1 bit
I declare a variable of 1 bit
0 Перем.jpg (100.88 KiB) Viewed 8090 times
1 Сим Флов.jpg
Flowcode showed a 1 bit
(173.27 KiB) Downloaded 815 times
2 Сим Прот.jpg
Proteus showed a byte
(221.66 KiB) Downloaded 815 times

User avatar
Osta
Posts: 159
Joined: Tue Jul 05, 2016 9:42 am
Been thanked: 13 times
Contact:

Re: Variable Bit Error

Post by Osta »

I did this device.
The real variable - BYTE !!!
Attachments
BUG.fcfx
Program
(6.38 KiB) Downloaded 261 times
The device itself
The device itself
3 Плата.jpg (160.23 KiB) Viewed 8090 times
Oscilloscope
Oscilloscope
4 Осцил.jpg (181.84 KiB) Viewed 8090 times

User avatar
Osta
Posts: 159
Joined: Tue Jul 05, 2016 9:42 am
Been thanked: 13 times
Contact:

Re: Variable Bit Error

Post by Osta »

This program
Attachments
Prog.jpg
Prog.jpg (45.12 KiB) Viewed 8087 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Variable Bit Error

Post 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 277 times
The file lives in the "Flowcode 7/CAL/PIC" directory.

User avatar
Osta
Posts: 159
Joined: Tue Jul 05, 2016 9:42 am
Been thanked: 13 times
Contact:

Re: Variable Bit Error

Post by Osta »

Hi Benj!
Yes! Now it works.
Now it is necessary to add the COF file ..
Regards Slava.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Variable Bit Error

Post 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 250 times

User avatar
Osta
Posts: 159
Joined: Tue Jul 05, 2016 9:42 am
Been thanked: 13 times
Contact:

Re: Variable Bit Error

Post 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.

Post Reply