Questions tagged [mplab]

IDE for the Microchip PIC series of microcontrollers.

Integrated Development Environment for the Microchip PIC series of microcontrollers.

614 questions
0
votes
1 answer

"initializer element is not constant" when using constant structs

I'm working with PIC32, MPLABX and XC32 and currently I have to make a lot of hardware description for each peripheral. Some of the tasks are something like: In file1.h extern const stream_t EHAL_PIN_STREAM_TEMPLATE; In file1.c const stream_t…
rnunes
  • 2,785
  • 7
  • 28
  • 56
0
votes
0 answers

MPLabX IDE Linker error with X32 compiler

I am using pic32 device for my c++ project. While compiling i got the following error: "C:\Program Files (x86)\Microchip\xc32\v1.30\bin\xc32-g++.exe" -mprocessor=32MZ2048ECM144 -o dist/default/production/DF.X.production.elf …
0
votes
1 answer

PIC16f877a switch not reading correctly

I am having a problem with a switch case when using the UART functions. I receive data and store it into the eeprom. I think call a switch statement to see what was sent. I read the eeprom and the information is right but I am just not able to…
0
votes
2 answers

PIC32 becomes unresponsive after a few hours

I have a PIC32MX340F512 board developed by another company for us, The board has a DS1338 RTCC and 24LC32A eeprom, and display unit on an I2C bus, on this bus i included a TSL2561 I2C light sensor, i wrote code in c to poll the light sensor…
0
votes
1 answer

Setting initial value for timer -register name

I have a timer in XC8 MPlab with PIC16F690 that is running great. I want to change its initial value. I could not find how to set a value into its register so it starts from that value. I'm looking for the syntax for that register to fill it with…
Curnelious
  • 1
  • 16
  • 76
  • 150
0
votes
0 answers

DMA interrupt for SPI

I'm trying to recreate a project of writing to an SD card (using FatFS) for a dsPIC33FJ128GP802 microcontroller. Currently to collect the date from the SPI I have a do/while that loops 512 times and writes a dummy value to the SPI buffer, wait for…
ritchie888
  • 583
  • 3
  • 12
  • 27
0
votes
3 answers

How to convert two Bytes array into unsigned long variable?

I want to combine two bytes into one unsigned long variable, my current code does not work. I am using MPLAB C18 compiler, this is my code. unsigned long red = 0; BYTE t[2]; t[0] = 0x12; t[1] = 0x33; red = 100 * t[0] +…
cookie monster
  • 77
  • 1
  • 10
0
votes
7 answers

How do you write and read to memory with PIC18?

I want to store a number to PIC18 then retain it even if the power is lost or the unit is reset. I think my writing code portion looks fine, just the reading portion of it looks strange after the unit is reset. I am using the following code which I…
Ammar
  • 1,203
  • 5
  • 27
  • 64
0
votes
1 answer

Getting Array Values from the user on PIC18?

First let me show what's working then I will show what's not working. This code gives the right result. unsigned long timeOn; long d[10]; d[0] = 8; d[1] = 6; d[2] = 0; d[3] = 0; d[4] = 0; timeOn = 10000*d[0] + 1000*d[1] + 100*d[2] + 10*d[3] + …
Ammar
  • 1,203
  • 5
  • 27
  • 64
0
votes
1 answer

Data Types with PIC18?

Which data type do I use to store the following value ? Value: 86400 code: int d[6]; unsigned int all; d[0] = 8; d[1] = 6; d[2] = 4; d[3] = 0; d[4] = 0; all = 10000*d[0] + 1000*d[1] + 100*d[2] + 10*d[3] + d[4]; printf("%u", all); If I copy…
Ammar
  • 1,203
  • 5
  • 27
  • 64
0
votes
1 answer

RN-41 bluetooth and dsPIC

Having a couple of issues with what I was hoping to be fairly straight forward. I've been transmitting data from my PIC to a PC via RS232 at a baudrate of 115200. I've recently got a RN-41 bluetooth module and was hoping the switch would be as…
ritchie888
  • 583
  • 3
  • 12
  • 27
0
votes
1 answer

Noisy ADC dsPIC

I've got a dsPIC33F collecting from two ADC channels, simultaneously, at 10bit. I'm using a timer to sample at 64Hz and have the ADC set to auto sampling, but manual conversion. Every time the timer interrupt is polled I'm clearing the sample bit…
ritchie888
  • 583
  • 3
  • 12
  • 27
0
votes
2 answers

Let C18 throw a compiler error

Is there a way to let the C18 compiler throw an own, customized error message during compiling? For example, consider a situation with two user-defined settings: #define SETTING_A 0x80 #define SETTING_B 0x3f Assume these settings can't be both…
user1544337
0
votes
1 answer

RS232 communication in MPlab

I am using MPlab to read data from a pic micro controller. I am using pic18F87J11. The data that I want to read is on pin 3 of the DB9 of the RS232, and my RS232 is connected to the pic micro controller. Can anyone help me or give me a simple sample…
user2226775
  • 1
  • 1
  • 2
0
votes
2 answers

constant expression required

unsigned char rtc_time[6] = { pThis->hoursTens, pThis->hoursUnits, pThis->minutesTens, pThis->minutesUnits, pThis->secondsTens, pThis->secondsUnits }; Does not compile. I receieve the error (6 times): constant expression required Each of the…
Michael
  • 309
  • 2
  • 3
  • 16