Variable Bit Error

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

Moderator: Benj

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

Variable Bit Error

Postby Osta » Wed Aug 17, 2016 10:22 am

Bit variable behaves as a byte....
Attachments
0 Перем.jpg
I declare a variable of 1 bit
0 Перем.jpg (100.88 KiB) Viewed 2954 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: 146
Joined: Tue Jul 05, 2016 9:42 am
Been thanked: 13 times
Contact:

Re: Variable Bit Error

Postby Osta » Wed Aug 17, 2016 10:36 am

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

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

Re: Variable Bit Error

Postby Osta » Wed Aug 17, 2016 10:54 am

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

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

Re: Variable Bit Error

Postby Benj » Wed Aug 17, 2016 11:18 am

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.52 KiB) Downloaded 91 times


The file lives in the "Flowcode 7/CAL/PIC" directory.

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

Re: Variable Bit Error

Postby Osta » Wed Aug 17, 2016 11:34 am

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

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

Re: Variable Bit Error

Postby Benj » Wed Aug 17, 2016 2:35 pm

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.59 KiB) Downloaded 77 times

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

Re: Variable Bit Error

Postby Osta » Wed Aug 17, 2016 3:01 pm

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.