Proper way to do calculations in a #define (AndersG)
Assume I want to do something like: #define DDSDIVISOR ((517000UL/FOSC)*4294967296UL) This will however evaluate to 0. The result of the division is less than one and hence it all ends up as 0. is...
View ArticleStrange compiling-error in function __builtin_movsac (Ubuntu, MPLAB_X, XC16,...
Hello, I'm from Germany and new in this Forum. I haven't much experiences in programming pic's but I realized a few small and easy projects with blinking LED's and that was no problem. But now I have...
View ArticlePIC24FJ128GA204 I2C slave not working (jojo_nexo)
Hi all, I tried to implement an I2C slave with a PIC24FJ128GA204. It is not working. I read through the paper on I2C about what Bits to set, but as it did not work as expected, I tried to cut it down...
View Articlethe % (modulus) operator does not work ?! (neworld)
unsigned char p; p = 15;p = p % 2;printf("\n\rp = %d", p);//prints p = 1 p = 14;p = p % 2;printf("\n\rp = %d", p);//prints p = 1 haha, love to hear the explanation behind this. tried xc16 v1.24 and...
View Articlefprintf sometimes behaves like printf (deadbeat)
Hi everyone, I am using XC16 (v1.32), MPLAB X IDE v4.01 and Simulator. This issue was also recreated on a different PC with xc16 v1.31 mplab-x v3.50. Configuration: - Uart1 IO options- Enable Uart IO...
View ArticleHow to call __delay_us() from interrupt.c? (RodoPIC)
Hi allI'm converting a project so I don't have function calls inside header files. I was told that's a no-no so I'd like to make it right. I'm doing it step by step because I got too many error when I...
View Article'attribute' and union --> one 'typedef' (sjb741)
XC16 1.32B I'm trying to combine a 'union' with __attribute__ ((space(eedata))) into one 'typedef'. If I explicitly place the 'attribute' along with the variable, I see no errors. If I place it as part...
View Articleincorrect config definitions for PIC24FJ64GA306 (andy_landy)
hi all, xc16 v1.32, targetting PIC24FJ64GA306. I had some problems getting segment write protection to work. #pragma config WPFP = WPFP40 // emits wrong value for any rval This emits the wrong value in...
View ArticleProblem configuring PWM on pic24fj256da210 (JustRob)
I'm using the PIC24FJ256DA210 Development board set up with the 3.2" graphics touch screen extender. I'm using the latest MPLABX IDE v4.00 with the ICD3 and the XC16 v1.32 on my Windows 10 desktop. I'm...
View ArticleSOLVED: sprintf Formatting To Float Using Modulo Not Working (Abraxas)
Another one that has me banging my head against the desk: The following code does not yield the desired 25.0625 , but rather 25.40960000 and I can't figure out why but think it has something to do with...
View ArticleStill confused about codeguard, __attribute((boot)) make functions return to...
Hi,I've been working on a bootloader for the dsPIC33EV series.I want to add security too. Easy/Usual way: Enable Read Protection, use boundary check in the bootloader so it can't reprogram...
View ArticleI found a bug in XC16 ? (JanJansen)
Hi, last week i was programming a DSPIC33FJ128GP802 in XC16 and found something weird.I installed the latest version today, the bug is still there. I try make bandlimited waveforms copying sinus data...
View ArticleDetecting float NaN and Infinity (GoEk)
Hi,is there a way in XC16 to detect if a float contains a "real" number (do not mean complex math) and not NaN or Inifinity?..
View Articleeds Memory Space compile problem (craigjbradley)
I am trying to use the EPMP port on a PIC24FJ1024GB610 using a the PIM module on an Explorer 16 board.The XC16 C Compiler (v1.32) User's Guide shows some example code in the following section. 8.10.3...
View ArticleNeed source for 3.2" TFT Graphics Display (JustRob)
I did a design using the pic24fj2156da210 development board with the Truly 3.2" 240 x 320 touch screen. I asked Microchip for a source but the source they gave me does not carry it. Has anyone done a...
View ArticleXC16 assembly (MicroStef)
Hi XC16: 1.26CPU: dsPIC30F5015 1)I can not find a document describing the assembler for this CPU, that is, what does "ZE" do and mean etc.I only get "hits" for the MPLABĀ® XC16 ASSEMBLER, LINKER AND...
View Articleelf-objdump.exe crashes if i want to declare some costants with...
Hi,Writing a bootloader, i want to keep it at the beginning of program memory (so space is already reserved IF i get to understand why i can't make things work when i enable codeguard and place...
View Articleextern uint8_t var not recognized in MCC generated code when compiled (brada)
I have a project that has MCC generated code in a subdirectory. I want to access a variable that is declared in code in the parent directory. Why is the extern declaration not recognized or accepted?...
View ArticleCan't install autonomously XC16 on Linux (Brane2)
I'm trying to make ebuild for Gentoo that would automatically install xc8/xc16/XC32 through gentoo's infrastructure ( portage). Unfortunately, they don't behave as documented....
View Articlegeneric build library (Kebims)
Hi evrybody, I have a problem with the "Generic build" option for XC16 compiler. I use this option because my code is generic and not use specific register.When I use my library with PIC24HJ256GP610...
View Article