Questions tagged [microchip]

Questions related to the microchip PIC family of microcontrollers. Where possible please specify the specific microcontroller.

Questions related to the microchip PIC family of microcontrollers. Where possible please specify the specific microcontroller.

696 questions
4
votes
1 answer

What causes this missing whitespace after the macro name error?

I am working on a project in MPLAB X v3.35 for a PIC24F. At some point in the last few weeks the compiler has started giving the following warnings for every line in the compilation. What in the compiler line could be causing this? The column number…
RobbG
  • 371
  • 5
  • 14
4
votes
0 answers

PIC24F EDS array causing address trap

Hi I am using the PIC24fj128gc006. I am running out of data memory so I am trying to allocate some of my buffers using the EDS space. Here is my declaration: #define BUF_BASE 0x010000L __eds__ float envelopStaticBuff[envelop_size] __attribute__…
Benjamin Hon
  • 143
  • 1
  • 11
4
votes
1 answer

Erasing flash memory in blocks (1024 bytes)

I am working on making a bootloader. I have to erase 1024 bytes of memory before I write anything to those registers in that block. Even if I want to write 2 bytes, I am forced to erase 1024 bytes. My problem is that I don't know where each block…
Ammar
  • 1,203
  • 5
  • 27
  • 64
4
votes
4 answers

PIC 16F684 Microcontroller Interupt Handling

I just finished up my Microprocessors class in college just a few weeks ago, there we programmed in assembly only. We learned a fair amount (IMHO) about interrupts. Here is my question: I am programming in C using the HiTech Compiler for the…
onaclov2000
  • 5,741
  • 9
  • 40
  • 54
4
votes
1 answer

Gather variables from multiple files into a single contiguous block of memory at compile time

I'd like to define (and initialize) a number of instances of a struct across a number of *.c files, but I want them to gather at compile time into a single contiguous array. I've been looking into using a custom section and using the section's start…
Isaac Sutherland
  • 3,082
  • 4
  • 28
  • 37
4
votes
2 answers

FTP Client for PIC microcontroller

Does anyone know of a Source Code for a FTP Client that I can use with a PIC microcontroller? Preferably in C and I am using a PIC 18F97J60. It is ok even if the source is for a different PIC, I can modify it to support my need. Thanks.
Bathiya Priyadarshana
  • 1,325
  • 6
  • 22
  • 35
3
votes
5 answers

why choose one's complement when writing to a register

What are the benefits of, for example writing the first statement vs second statement: First statement: ANCON1 = ~0x0C; Second statement: ANCON1 = 0xF3; I'm seeing the second as a clear choice I would have made, cause it's more straight forward…
Christian
  • 1,548
  • 2
  • 15
  • 26
3
votes
4 answers

How to make a !default case in C

On a micro-controller program I have a few instructions that I would like to execute for every case in a switch except the default. I do not, however, want to write a function call or use a macro for every case. Because this is for a…
Jeremy
  • 103
  • 12
3
votes
2 answers

microchip exception handling

While running my program on a microchip ICD3 device, the exception handling looks weird. The program will stop response while exception occurs. While checking the code, I noticed that the default-general-exception-handler.c will create an infinite…
lucemia
  • 6,349
  • 5
  • 42
  • 75
3
votes
1 answer

AVR32DA28 phase and frequency correct PWM

AVR32DA28 Datasheet I am trying to make a pwm with phase and frequency correct and with two signal one should be inverted and another should be non inverted.. I have prepared some line of code as followed int8_t PWM_0_init() { TCA0.SINGLE.CMP0 =…
3
votes
0 answers

Microchip C inline asm does not generate prefix for immediates in inline asm

Im trying to implement my own memcpy function in asm. CPU is dsPIC33F, compiler Microchip C30. asm("repeat %2 \n mov.b [%1++], [%0++]" : : "r"(dst), "r"(src), "ri"(len)); When len is variable, this works fine: the compiler picks a register and…
Woodoo
  • 129
  • 6
3
votes
1 answer

Assembly instruction to machine code

I'm trying to convert MOVFF 0x10, 0x15 to machine code. The Microcontroller is Microchip PIC 18F1220. The reference manual says: MOVFF fs,fd Encoding: 1st word: 1100 ffff ffff ffffs 2nd word: 1111 ffff ffff ffffd The solution is: 1100 0000 0010…
user
  • 31
  • 2
3
votes
1 answer

.inc File Not Included Reliably

I am working on some HTML code that was inherited from another programmer, which uses include statements of the form: ~inc:filename.inc~ However, the problem I am encountering is that this include statement does not work reliably. About 90% of the…
CodeRedd
  • 283
  • 1
  • 4
  • 14
3
votes
1 answer

PIC 18F45K42: How to combine 4 bytes to Int?

I am writing code for a PIC 18F45K42 to read .wav files from an HCSD card. I am using MPLAB X IDE v5.20 and XC v2.05. I am using FATFs library to read data off the card. I can read data off the card and get good results until it comes to combining…
Peter Wiley
  • 820
  • 7
  • 19
3
votes
1 answer

Enable data memory PIC 18F4550

I'm using the PIC18F4550 from microchip with the c compiler: by default the 'program memory' is used, but now I want to use the 'data memory' because it gives me a big more functionality, can enyone just tell me how can I to that in the program…
user717262
  • 43
  • 3
1 2
3
46 47