Questions tagged [microcontroller]

This tag is related to questions that have something to do with a microcontroller. A microcontroller is a simple or small processor often with its program and execution memory on the same chip with input/output pins for controlling other hardware. Please specify the microcontroller and compiler or tools related to your question.

This tag is related to questions that have something to do with microcontrollers in general. A microcontroller is a simple or small processor often with its program and execution memory on the same chip with input/output pins for controlling other hardware. Microcontroller programs are embedded programs often talking directly to hardware registers without using an operating system. Microcontrollers are generally resource limited, program space measured in bytes, kilobytes or megabytes, processor clock speeds often in the kHz and tens of MHz range.

3656 questions
154
votes
13 answers

How are everyday machines programmed?

How are everyday machines (not so much computers and mobile devices as appliances, digital watches, etc) programmed? What kind of code goes into the programming of a Coca-Cola vending machine? How does my coffee maker accept a pre-programmed time…
Josh Leitzel
  • 15,089
  • 13
  • 59
  • 76
86
votes
14 answers

What is the difference between baud rate and bit rate?

I am really having hard time understanding the difference. Some say they are same, while others say there is a slight difference. What's the difference, exactly? I would like it if you explained with some analogy.
dimSutar
  • 1,425
  • 2
  • 13
  • 17
75
votes
16 answers

What are the available interactive languages that run in tiny memory?

I am looking for general purpose programming languages that have an interactive (live coding) prompt work in 32 KB of RAM by itself or 8 KB when the compiler is hosted on a separate machine run on a microcontroller with as little as 8-32 KB RAM…
dwhall
  • 657
  • 1
  • 8
  • 13
48
votes
9 answers

How can I make my own microcontroller?

How can I make my own microcontroller? I've done some work using GAL chips and programmed a chip to do simple commands such as add, load, move, xor, and output, but I'd like to do something more like a real microcontroller. How can I go about doing…
samoz
  • 56,849
  • 55
  • 141
  • 195
44
votes
6 answers

What is a "packed" structure in C?

I am going though some C code written for the Microchip C30 compiler and I often see structs defined as follows: typedef struct __attribute__((__packed__)) { IP_ADDR MyIPAddr; // IP address IP_ADDR MyMask; …
PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
37
votes
14 answers

Does it matter which microcontroller to use for 1st time embed system programmer?

I've experience in doing desktop and web programming for a few years. I would like to move onto doing some embed system programming. After asking the initial question, I wonder which hardware / software IDE should I start on... Arduino + Arduino…
Henry
  • 32,689
  • 19
  • 120
  • 221
37
votes
20 answers

AVR or PIC to start programming Microcontroller?

Which family should I start to learn? (Never did any programming on microcontroller)
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
34
votes
5 answers

Power off an USB device in software on Windows

I would like to power cycle an USB device through software on Windows. I am doing development on a small USB power microcontroller. This chip will revert to native behavior on a power cycle and allow a code download. Since my code will crash the…
Perpetual Student
33
votes
10 answers

Where to begin with programming for robotics?

Ok so i've been interested in robotics for a while and had a project in mind. Building a small remote controlled vehicle-robot/ unmanned vehicle-robot. Hopefully with the ability to read in data from sensory devices(gps,thermometer etc) and write…
Julio
  • 1,815
  • 7
  • 20
  • 22
30
votes
5 answers

Bitwise operation results in unexpected variable size

Context We are porting C code that was originally compiled using an 8-bit C compiler for the PIC microcontroller. A common idiom that was used in order to prevent unsigned global variables (for example, error counters) from rolling over back to zero…
Charlie Salts
  • 13,109
  • 7
  • 49
  • 78
28
votes
5 answers

How to force an unused memory read in C that won't be optimized away?

Microcontrollers often require a register to be read to clear certain status conditions. Is there a portable way in C to ensure that a read is not optimized away if the data is not used? Is it sufficient that the pointer to the memory mapped…
Judge Maygarden
  • 26,961
  • 9
  • 82
  • 99
27
votes
3 answers

Do interrupts interrupt other interrupts on Arduino?

I have an Arduino Uno (awesome little device!). It has two interrupts; let's call them 0 and 1. I attach a handler to interrupt 0 and a different one to interrupt 1, using attachInterrupt() :…
Chris Laplante
  • 29,338
  • 17
  • 103
  • 134
27
votes
3 answers

UART vs I2C vs SPI for inter-processor communication between microcontrollers

I am examining a way to connect two microcontrollers. On the level of serialization I am thinking of using Nano protobuffers (http://code.google.com/p/nanopb/). This way I can encode/decode messages and send them between two processors. Basically,…
Drasko DRASKOVIC
  • 343
  • 1
  • 3
  • 8
26
votes
4 answers

Unit testing patterns for microcontroller C code

Although there are plenty of unit test frameworks that support C, I'm a little stumped on how to write unit tests for micro controller code (PIC in my case, but I think the question is more general than that). Much of the code written for micro…
Steve Hawkins
  • 1,433
  • 4
  • 17
  • 24
25
votes
19 answers

Best way to get started with programming other things than your computer?

What is the best way to get started with programming things outside of your computer? I don't mean mainstream things like cell phones with APIs. Please assume working knowledge of C/C++
Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
1
2 3
99 100