Questions tagged [xc16]

XC16 is Microchip's gcc-based compiler suite for PIC24 and dsPIC targets.

58 questions
0
votes
1 answer

time(NULL) returns 0 on PIC-IoT WG development board

I'm working on a project with the PIC-IoT WG wifi development board. I'm trying to modify the demo code to be able to use it on my own servers. The demo uses code like this in several places: #include static void connectMQTT() { uint32_t…
Dave12311
  • 29
  • 5
0
votes
1 answer

UART PIC24 - Receive continuous stream of ASCII characters

I am currently using the PIC24 with UART and am able to receive (Rx) and transmit (Tx) characters. The problem arises when trying to receive a continuous stream of characters, where there is no delay between start and stop bits. The UART is setup…
DARTH
  • 1
  • 1
0
votes
1 answer

How to switch the optimization level of the compiler partially for every function?

How can I switch the optimization level of my compiler (xc16) on a different level for each function? for example: void _ISR _T1Interrupt //compile with O0 { ..... } int_16_t main (void) //compile with O2 { ..... }
Mike
  • 4,041
  • 6
  • 20
  • 37
0
votes
1 answer

objcopy for pic30/xc16 - where to find, analogs

I am working with a non-standalone project on PIC24 which requires a bootloader and I want to debug it with a bootloader. I am able to produce an .hex file that contains the application code with the bootloader, registering a custom script that…
Carry
  • 11
  • 1
0
votes
2 answers

External interrupt source on PIC24F16KA102

I'am trying to work with the external interrupt source and I wrote a small program to test the interrupt. When I start the program RB0 is set low, and RB1 is set high. If I set RB7 high, it must be generated an interrupt that reverses the logic…
Fire91
  • 11
0
votes
1 answer

Building foo.cpp as C code with Microchip XC16 compiler

I have some code that is shared between a C++ Windows application and an XC16 C application. The source is written in such a way that it compiles cleanly under MSVC and XC16 (with appropriate use of the __cplusplus macro). The problem is that XC16…
EBlake
  • 735
  • 7
  • 14
0
votes
1 answer

MPLAB unable to combine .s and .c files

I am using MPLAB v4.0.5 on my Mac, with the XC16 v1.33 compiler. I have two files, thom5409_disc2_main_v001.s and thom5409_disc2_main_v001.c . The following code was provided to help get us started and other students in my class were able to get the…
0
votes
2 answers

Microchip XC16 : Can we access Port using its address ?? for ex : &PortA?

As my question says, to access Port by its address, Can we write it as "&PORTA" ?? In my problem, I want to read/write port value from/to HMI, using Modbus Protocol. I have an array of structure : typedef struct func_code_reg { volatile…
skg
  • 948
  • 2
  • 19
  • 35
0
votes
1 answer

Is it possible to access XC16/gcc target flags from within code?

I am compiling code for Microchip dspic33 series processors using Microchip's XC16 compiler. I have some code that is used in several applications (i.e. it is in a code library). For certain modules, I want to ensure that certain compiler flags are…
EBlake
  • 735
  • 7
  • 14
0
votes
2 answers

MPLAB XC16: Mixing C and Assembly

I am attempting to mix some C and assembly language and I am having a bear of a time. I am experienced with C, somewhat with assembly, but I haven't used them on the same project before. At the moment, I am attempting to compile the simplest…
slightlynybbled
  • 2,408
  • 2
  • 20
  • 38
0
votes
2 answers

Why does this typedef give a sizeof() value larger than expected?

I use typedefs of this form to simplify access to microprocessor registers and bit fields within them. typedef union { uint8_t u8Byte; ///< REG_8 as unsigned byte int8_t i8Byte; ///< REG_8 as signed…
EBlake
  • 735
  • 7
  • 14
0
votes
1 answer

Can't use a typedef enum to store state information

hi - I'm using the XC16 C compiler with a Microchip dsPIC33F CPU. I'm trying to use an enum to store the state of a device. I have accessors to get and set the device state. The state is (or should be) captured in a variable called…
0
votes
1 answer

ADC reading keeps jumping around on dspic33FJ128MC802, cannot get a stable reading, mplab8.92, xc16 compiler

Good evening, I'm trying to implement a simple 1 channel ADC reader on a dspic33FJ128MC802, that manually starts sampling data, automatically converts when the sampling is done, and reads and stores data. This has never been an issue for me, except…
Mich
  • 3,188
  • 4
  • 37
  • 85
1 2 3
4