Contents
What is _ _ bit in the xc8 C compiler?
The MPLAB XC8 C compiler supports various special keywords (for example the persistent type qualifier). If the –STRICT option is used, these keywords are changed to include two underscore characters at the beginning of the keyword (for example, __persistent) so as to strictly conform to the ANSI standard.
Can a table be defined without Assembly in xc8?
It is almost possible to do this in XC8 without assembly. Assembly must be used to define the table because XC8 does not have any C language extension to declare constant data in code space as packed 14-bit words. To do this requires at least two source files.
Is there a way to initialize xc8 in C?
Since this code is valid C, XC8 has to implement it by running some initialization code that literally does something akin to mytable [0] = 1; mytable [1] = 2; …. This is very expensive in terms of code space required to do this initialization and is to be avoided by any seasoned PIC dev.
How to use lookup tables in PIC assembly?
Since the opcode returns to something, it is usually inside a subroutine. Take note that RETLW reads the stack for the address to which to return. So a GOTO followed by RETLW will result in a stack underflow error. The most common lookup table is the one for seven segment displays.
When to use extern in the C compiler?
Whether you have extern int foo (void); or just int foo (void); in your .h your compiler will read is as a function prototype either way. Its necessary for global variables though since unlike functions they don’t have prototypes.
When to use _ _ persistent in xc8 C compiler?
If the –STRICT option is used, these keywords are changed to include two underscore characters at the beginning of the keyword (for example, __persistent) so as to strictly conform to the ANSI standard. Thus if you use this option, you will need to use the qualifier __persistent in your code, not persistent.
Is the MPLAB XC C compiler free to use?
Available as free, unrestricted-use downloads, our award-winning MPLAB ® XC C Compilers are comprehensive solutions for your project’s software development. Finding the right compiler to support your device is simple: