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
6
votes
2 answers

Which is the better approach to multiplying two bytes using only bit-shifting and adding?

Initial Question: A group of us (electronic engineering students - UK) have recently been getting to grips, in our own time, with programming the PIC16F84A microcontroller. The need has arisen to multiply two 8-bit numbers together, with no known…
Iakovosian
  • 361
  • 1
  • 4
  • 12
5
votes
3 answers

Speed of nested if vs for loop

I recently came across this piece of code in an interrupt service routine (ISR): #define MAX_CHANNELS 4 static uint16_t volatile* ADCVALS[MAX_CHANNELS] = { &ADC1BUF0, &ADC1BUF1, &ADC1BUF2, &ADC1BUF3 }; static uint8_t CHANNELS = 0; static…
abessman
  • 75
  • 6
5
votes
2 answers

Force the linker to put the same code in 2 sections

I am trying to force the linker (ld from XC32) to place the same executable code in two different sections of flash. The application is so that the code can be run as a standalone application, and also so that the reset vector can be overridden by…
Colin
  • 3,394
  • 1
  • 21
  • 29
5
votes
4 answers

Writing apps in C for microcontrollers

What resources do you know dedicated to software development in C for PIC microcontrollers? I would like to see some kind of framework that handles both IO (buttons for input and LCD for output) and application logic. You can think of it as a VERY…
grigy
  • 6,696
  • 12
  • 49
  • 76
5
votes
3 answers

8051 microcontroller kit recommendation?

I'm a first year Computer Science student looking to get started with development for micro-controllers. I'd like to use the 8051, as it's common as dirt, and is used frequently in the real world. During my junior or senior year, I'll be taking a…
LucidDefender
  • 219
  • 2
  • 4
5
votes
1 answer

USB HID protocol question

I'm implementing USB on a PIC 18F2550 using a generic HID interface. I've set up the HID profile configuation to have a single 64 byte message for both inputs and outputs. Now it's basically working. The device registers OK with windows. I can find…
jcoder
  • 29,554
  • 19
  • 87
  • 130
5
votes
3 answers

What do these macros do?

I have inherited some heavily obfuscated and poorly written PIC code to modify. There are two macros here: #define TopByteInt(v) (*(((unsigned char *)(&v)+1))) #define BottomByteInt(v) (*((unsigned char *)(&v))) Is anyone able to explain what on…
DiBosco
  • 838
  • 8
  • 21
5
votes
2 answers

Program exits endless loop (PIC microcontroller)?

I wrote a program for the PIC 16f690 microcontroller after noticing my programs seemed to be exiting an endless loop. There are LEDs on pins 3,4,5 of PORTC. #include #define _XTAL_FREQ 4000000 void main(void) { TRISC = 0x00; PORTC =…
5
votes
6 answers

How to reset a PIC18 in C?

What is the best way to reset a PIC18 using C code with the HiTech Pic18 C compiler? Edit: I am currenlty using void reset() { #asm reset #endasm } but there must be a better way
Charles Faiga
  • 11,665
  • 25
  • 102
  • 139
5
votes
1 answer

UART DMA for varying sized arrays

Using MPLAB X 1.70 with a dsPIC33FJ128GP802 microcontroller. I've got an application which is collecting data from two sensors at different sampling rates (one at 50Hz, the other at 1000Hz), both sensor packets are also different sizes (one is 5…
ritchie888
  • 583
  • 3
  • 12
  • 27
5
votes
9 answers

I'd like to move on to µC programming, but I have absolutely no idea where to start from

I've been thinking quite some time about 'moving on' to MCU programming, but the problem is I've never worked with any microcontrollers or similar. As I've been told, AVR and PIC are the most common microcontrollers among hobbyists, and apparently…
Hoffa
  • 279
  • 1
  • 8
5
votes
3 answers

Where can i find the 16F877A.h?

When i run my program in MPLAB. ( Project wizard -> PIC16F877A -> Hi Tech Ansi C Compiler -> RUN ) Error [141] C:\Users\WhyWhy\Desktop\test.c; 1.22 can't open include file "16F877A.h": No such file or directory Where can i find the header file…
whywhy
  • 155
  • 1
  • 6
  • 13
5
votes
3 answers

Embedded code development (especially for PIC with C18) in Visual Studio

I'm using Visual Studio for writing desktop applications, and I find it very user friendly and easy to use. If possible, I also want to write embedded code in Visual Studio. For example, is it possible to generate .hex files for PIC18Fxxx series…
user1399721
5
votes
8 answers

PIC16 C compiler

I am looking for a good C compiler for the PIC 16 family, working on Windows. A couple of colleagues use bknudc but some seem to dislike it. Apparently you cannot use the linker efficiently, and it turns out that the best is to set all code in…
Gauthier
  • 40,309
  • 11
  • 63
  • 97
4
votes
1 answer

How to call Microchip PIC USB DLL with Delphi 2009

Not a question, just a statement to help anyone else who might spend hours getting the Microchip PIC USB DLL to work properly with Unicode. It expects several strings, and although these are simple PAnsiChar, getting the right combination of DLL…
Brian Frost
  • 13,334
  • 11
  • 80
  • 154