Questions tagged [pic]

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology.

PIC is a family of modified Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller". wikipedia


For questions regarding Position-Independent Code, use instead.

1624 questions
2
votes
2 answers

Is it possible to create a PIC firmware binary that supports multiple different microcontrollers?

Due to the current chip shortage, I have had to purchase PIC microcontrollers that have a different specification to what was initially designed. Initial: PIC24FJ256GA606 Revision 1: PIC24FJ512GA606 Revision 2: PIC24FJ1024GA606 In this instance,…
wntwrk
  • 317
  • 1
  • 2
  • 10
2
votes
1 answer

Cant combine 2 values together?

I'm using the PIC18lF47k42 with XC8 compiler. I'm trying to get this full 12bit ADC value so I have the full resolution however, I can't seem to get the 4 bits of data from ADRESL to go into result with the data from ADRESH. Result is a 16bit…
TJL6012
  • 23
  • 3
2
votes
2 answers

How to place variables in the access bank - PIC 18 MPASM linker script

I have a linker script which starts INCLUDE 18f14K50_g.lkr I want my interrupt service variables to go into the ACCESS bank. (My program's so small at the moment the whole lot can, but maybe in future...). So SECTION NAME=VarsModemISR …
Richard Corfield
  • 717
  • 6
  • 19
2
votes
2 answers

How to put a variable at a specific memory location in SDCC

For low-level programming, sometimes it's necessary to say, at a given memory location, this is where my address is. For this post, the example is the PIR1 register in the PIC16F886 and related microcontrollers. It's always found at address…
Lorraine
  • 1,189
  • 14
  • 30
2
votes
2 answers

F/OSS for the PIC24?

I'm learning embedded programming with the PIC24, and I'm looking for something "real-world" to dig into to help me learn. Are there any free software projects that might be targeting to the PIC? Anything that I could help port, or a niche I could…
jparker
  • 1,569
  • 2
  • 16
  • 16
2
votes
4 answers

How to convert an int to a series of characters

I'm trying to break down an integer with C on an 8-bit microcontroller (a PIC) into its ASCII equivalent characters. For example: convert 982 to '9','8','2' Everything I've come up with so far seems pretty brute force. This is the main idea of what…
tarabyte
  • 17,837
  • 15
  • 76
  • 117
2
votes
1 answer

From MPLAB 8.92 to MPLAB X 5.25: how do I programmatically halt the simulator now?

I wrote some test code in PIC assembly language that I have no intention to run on the actual PIC MCU, rather it is meant to generate the trace files so that they can be analyzed later with a separate tool. So, I needed a way to permanently halt the…
Regus Pregus
  • 560
  • 3
  • 12
2
votes
1 answer

Issue in interfacing SPI e-ink display with PIC 18F46K22

I am using a PIC 18F46K22 in SPI master mode to communicate with a Waveshare 1.54" ePaper Module. The FOSC frequency is 8Mhz internal and SPI configuration is FOSC/4. So when I check the output on logic-analyzer some output bits are differ from…
2
votes
3 answers

Configurations variables removed by compiler

I am attempting to define a set of global variables which will configure my device, about 10 in a dedicated .c file, that will be changed on a regular basis at compile time (as per device requirements), I want these to be in this separate file so…
2
votes
1 answer

Debounce button in PIC

I newbie in PIC mcu. I use pic12f675 MPLAB and XC8 for make an LED multiple blink pattern. and I have problem with push button (after review it call Bounce and Debounce). Sometime when I press button it will in sequence ex. 1->2->3->4->5 but…
ku_thai
  • 43
  • 6
2
votes
1 answer

C: simple code not working as expected (PIC micro)

This line isn't working as expected: uartPushPos = (uartPushPos + 1) % UART_TX_BUFF_LENGTH; However this below, which in theory does the same, does work: //if (uartPushPos == UART_TX_BUFF_LENGTH - 1){ if (uartPushPos >= UART_TX_BUFF_LENGTH - 1){ …
Jodes
  • 14,118
  • 26
  • 97
  • 156
2
votes
1 answer

EZBL_EraseAll or EZBL_NVMKEY not working in mplab x IDE version 5.4

I have a bootloader working for mplab x IDE v4.2 for years. It is compilated with XC16 1.35. We are updating it to be used on MPalb x IDE v5.40. I have been able to make this by creating an example of ezbl and replacing the files with my code from…
Hamboy75
  • 938
  • 1
  • 11
  • 22
2
votes
1 answer

Accuracy of Timer1 as real time clock with PIC Interrupts on 16F*

I'm using C with the BoostC compiler. I'm worried how accurate my code is. The configuration below ticks at more or less 1Hz, (tested with an LED to the naked eye). (It uses an external watch crystal 32kHz for Timer1 on the 16f74). I'm hoping…
Jodes
  • 14,118
  • 26
  • 97
  • 156
2
votes
1 answer

Is there any way to change ADC conversion time in the PIC16F886?

#include #pragma config FOSC = HS void main() { OSCCONbits.IRCF = 0b111; OSCTUNE = 0b01111; OSCCONbits.SCS = 0; OSCCONbits.OSTS = 1; OSCCONbits.HTS = 1; OSCCONbits.LTS = 1; TRISBbits.TRISA2 = 0; …
2
votes
2 answers

What is a normal interrupt latency and context saving time on Microchip C18?

I am using the Microchip C18 compiler and on occurrence of an interrupt I am experiencing a quite long delay before the ISR code starts running. As an experiment, this is in my main function: while(1) { LATAbits.LATA4 = 1; LATAbits.LATA4 =…
AndreKR
  • 32,613
  • 18
  • 106
  • 168