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
8
votes
13 answers

Multithreading using C on PIC18

How does one create threads that run in parallel while programming PIC18, since there is no OS?
M3.
  • 81
  • 1
  • 2
7
votes
4 answers

How to recover from I2C bus collision BCLIF?

I posted this a couple of days ago on the Microchip Forum (here) but the only response has been crickets. The I2C code below works most of the time but occasionally on power-up there is a bus collision (BCLIF) and the I2C module is unable to recover…
jacknad
  • 13,483
  • 40
  • 124
  • 194
7
votes
3 answers

compiler optimizes out pointer to function when address is assigned manually

I need to call a function at address 0xDD2: // foo.h void foo(void) __at(0xDD2); // foo.c #include "foo.h" void foo(void) { // some code } This code works: #include "foo.h" void main(void) { void (*a)(void) = &foo; a(); } However,…
AmirSina Mashayekh
  • 498
  • 1
  • 5
  • 21
7
votes
3 answers

Why does this code break when -O2 or higher is enabled?

I tried to fit an implementation of NSA's SPECK in a 8-bit PIC microcontroller. The free version of their compiler (based on CLANG) won't enable optimizations so I ran out of memory. I tried the "trial" version that enables -O2, -O3 and -Os…
hjf
  • 453
  • 5
  • 16
7
votes
3 answers

Which interpreted language can work on on microchip PIC32?

I'm looking for an interpreted language that work on microchip PIC32. Currently, I found that LUA and PAWN are working but before choosing I would like to know if some other languages are known to work in PIC32.
acemtp
  • 2,971
  • 6
  • 34
  • 43
7
votes
0 answers

cdc_acm : failed to set dtr/rts - can not communicate with usb cdc device

I was trying to enumerate usb cdc device using pic24fj128gb206. Device seems to be enumerated properly. But when I connect my device to Linux PC, I am getting the below warning message from kernel. cdc_acm 1-8.1.6.7:1.0: failed to set dtr/rts And…
AKV
  • 425
  • 7
  • 20
7
votes
5 answers

Whats the best resource to learn Assembly language for PIC microcontroller's

I'm going to start working on a project where I need to have a decent understanding of Assembly language for the PIC microcontroller's. I'm intimately familiar with C/C++, so I know how to code for the most part, and I have done many projects for…
Seidleroni
  • 1,044
  • 3
  • 15
  • 31
6
votes
6 answers

Is my MIPS compiler crazy, or am I crazy for choosing MIPS?

I am using a MIPS CPU (PIC32) in an embedded project, but I am starting to question my choice. I understand that a RISC CPU like MIPS will generate more instructions than one might expect, but I didn't think it would be like this. Here is a snippet…
Rocketmagnet
  • 5,656
  • 8
  • 36
  • 47
6
votes
2 answers

Is it bad practice to redefine register masks for PIC24 in order to improve readability?

I am relatively new to working with PIC chips, so this might be a novice-level question, but I am attempting to write a header file containing, among other things, the TRIS/ODC/INIT masks for all of the I/O ports. On the PCB this chip is built into,…
6
votes
2 answers

PIC16F1829 UART RX Interrupt not working using MPLABX and XC8 compiler

I am new to writing firmware for 8-bit PICs and could use some help with my code. I am using a PIC16F1829 for an LED module which gets RX commands. I am just trying to get the basics setup like turn on LEDs when a certain value is received on RX…
humanistscience
  • 119
  • 1
  • 8
6
votes
1 answer

Create big buffer on a pic18f with microchip c18 compiler

Using Microchip C18 compiler with a pic18f, I want to create a "big" buffer of 3000 bytes in the program data space. If i put this in the main() (on stack): char tab[127]; I have this error: Error [1300] stack frame too large If I put it in…
acemtp
  • 2,971
  • 6
  • 34
  • 43
6
votes
1 answer

How to configure 8051 pins as input/output?

In pic microcontroller TRIS register determines whether port would act as input or output and PORT register would determine the content, what should be written (in case of output) or read (in case of input). But in 8051 there isn't any such kind of…
6
votes
1 answer

How do you understand Hex file ? (Extended Address Record)

I am trying to make a bootloader for PIC18 so I need to understand how to process a hex file correctly. For example I understand what to do with the following hex line. :040C0000E2EFFFF030 04: number of bytes 0C00 : Address of hex digits 00:…
Ammar
  • 1,203
  • 5
  • 27
  • 64
6
votes
3 answers

What does __attribute__((__interrupt__, no_auto_psv)) do?

void __attribute__((__interrupt__, no_auto_psv)) _T1Interrupt(void) // 5 Hz __attribute__ directive or macro is from GCC but __interrupt__ and no_auto_psv is not , it's specific to a hardware. So, how does GCC Compiler understand __interrupt__…
jason hong
  • 435
  • 1
  • 7
  • 12
6
votes
3 answers

How to reduce the code space for a hexadecimal ASCII chars conversion using a _small_ code space?

How to reduce the code space for a hexadecimal ASCII chars conversion using a small code space? In an embedded application, I have extraordinary limited space (note 1). I need to convert bytes, from serial I/O, with the ASCII values '0' to '9' and…
chux - Reinstate Monica
  • 143,097
  • 13
  • 135
  • 256