• AVR Freaks

Hot!Variabel bit

Author
Phill Lima
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2017/06/13 17:08:54
  • Location: 0
  • Status: offline
2019/04/20 09:10:12 (permalink)
0

Variabel bit

Hello everyone, I'm having trouble declaring the variable of type bit
Usually used in xc8 with a project on PIC18F45k40
But today I started a small project in a PIC18F2550 that I have stopped, still with the very basic program, I declared a variable for testing:
bit Teste;

and when compiling, returns the following error:

CLEAN SUCCESSFUL (total time: 29ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'D:/Projetos Microcontroladores/Projetos PIC - MPLABx/Relogio_2550.X'
make -f nbproject/Makefile-default.mk dist/default/production/Relogio_2550.X.production.hex
make[2]: Entering directory 'D:/Projetos Microcontroladores/Projetos PIC - MPLABx/Relogio_2550.X'
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F2550 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/main.p1 main.c
In file included from main.c:17:
./variaveis.h:8:1: error: unknown type name 'bit'
make[2]: *** [build/default/production/main.p1] Error 1
bit Teste;
^
make[1]: *** [.build-conf] Error 2
1 error generated.
make: *** [.build-impl] Error 2
(908) exit status = 1
nbproject/Makefile-default.mk:106: recipe for target 'build/default/production/main.p1' failed
make[2]: Leaving directory 'D:/Projetos Microcontroladores/Projetos PIC - MPLABx/Relogio_2550.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'D:/Projetos Microcontroladores/Projetos PIC - MPLABx/Relogio_2550.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 3s)

 
Do you know what it can be?
#1

4 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 17610
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Variabel bit 2019/04/20 09:19:58 (permalink)
    +3 (3)
    Did you include xc.h?
    Are you using XC8 in C99 mode for the first time? You need to read the Migration Guide in the compiler documentation.
    I think it is _bit for C99

    Or you can set C90 mode in the compiler options, to use the old way.
    #2
    1and0
    Access is Denied
    • Total Posts : 9495
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Variabel bit 2019/04/20 10:46:50 (permalink)
    +4 (4)
    Phill Lima

    "C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=18F2550 ... -std=c99 

    Do you know what it can be?

    You are using C99 mode, so it should be __bit with two leading underscores.
     
    #3
    Phill Lima
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2017/06/13 17:08:54
    • Location: 0
    • Status: offline
    Re: Variabel bit 2019/04/21 12:48:49 (permalink)
    0
    Thanks guys, the problem is exactly this ...
    How should I then use the variables described in the xc8 guide? already is included in my code o xc.h
    #include <xc.h>
    and even then does not recognize the declaration of the variable of type bit.
    Using the __bit already solves for me, but my doubt is the size and type of variables that I am already accustomed programming the 18fxxKxx family.
    Once again, thank you guys.
    #4
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Variabel bit 2019/04/21 13:50:01 (permalink)
    +1 (1)
    Read post #3 again.
    It is because you are using a brand new version of the compiler (XC8 version 2.xx) in a brand new mode (C99).
    You can change it in the project settings to use C90 mode instead, which is compatible with your old code.
    the __bit syntax is compatible with both versions of the compiler.
     

    Nearly there...
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5