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

Microcontroller + Verilog/VHDL simulator?

Over the years I've worked on a number of microcontroller-based projects; mostly with Microchip's PICs. I've used various microcontroller simulators, and while they can be very helpful at times, I often find myself frustrated. In real life…
Brandon Fosdick
  • 15,673
  • 4
  • 21
  • 20
15
votes
4 answers

Included files, all or nothing?

If I #include a file in C, do I get the entire contents of the file linked in, or just the parts I use? If it has 10 functions in it, and I only use one of the functions, does the code for the other nine functions get included in my executable? This…
15
votes
1 answer

CAN communication between LPC 2292 and LPC1758 boards "Start of Frame " error

I am trying to setup CAN communication between a couple of LPC device nodes. My setup includes a couple of CAN nodes writing on to the CAN bus. For example LPC 2292 CAN controller can write on to the CAN bus and the LPC1758 can receive the data.…
rockstar
  • 3,512
  • 6
  • 40
  • 63
14
votes
4 answers

How to configure VS Code to build and debug STM32 projects using cubeMX - Windows 10

I am new to the realm of STM32 programming and have been trying to find a suitable IDE for quite a while now. I know of all the other IDE's like Keil and IAR but the cost of buying them just to learn is far to steep for me at this point in time. I…
clixxclixx
  • 147
  • 1
  • 1
  • 7
14
votes
1 answer

What is the use of __IO & static keywords in C?

I was checking out some code written for STM32F microcontroller and I found these keywords used before initializing a variable. I would like to know what is the significance of using this "__IO" & "static" keywords? The line of code was given like…
Naasif
  • 495
  • 2
  • 6
  • 13
14
votes
1 answer

Allocating memory in Flash for user data (STM32F4 HAL)

I'm trying to use the internal flash of an STM32F405 to store a bunch of user settable bytes that remain after rebooting. I'm using: uint8_t userConfig[64] __attribute__((at(0x0800C000))); to allocate memory for the data I want to store. When the…
HammerFet
  • 841
  • 3
  • 10
  • 16
14
votes
7 answers

Where can I find soft-multiply and divide algorithms?

I'm working on a micro-controller without hardware multiply and divide. I need to cook up software algorithms for these basic operations that are a nice balance of compact size and efficiency. My C compiler port will employ these algos, not the…
srking
  • 4,512
  • 1
  • 30
  • 46
14
votes
6 answers

How hard is it for a software developer to learn how to program a microcontroller?

I'm a software developer. I've been programming in high level languages for a few years. I would like to know, how to take my first step into programming hardware. Not something crazy complicated, but maybe some ordinary CE device? Assuming I…
Henry
  • 32,689
  • 19
  • 120
  • 221
14
votes
10 answers

What language to learn for microcontroller programming?

I'm getting into microcontroller programming and have been hearing contrasting views. What language is most used in the industry for microcontroller programming? Is this what you use in your own work? If not, why not? P.S.: I'm hoping the answer is…
harry
  • 329
  • 2
  • 4
  • 5
14
votes
2 answers

what is the difference between hardware watchdog and software watchdog?

what is the difference between hardware watchdog and software watchdog ?
M Sharath Hegde
  • 485
  • 1
  • 6
  • 20
14
votes
8 answers

difference between memory address register(MAR) and program counter(PC)?

How memory address register(MAR) and program counter(PC) are different from each other?
Imran
  • 181
  • 1
  • 1
  • 5
14
votes
5 answers

Is it possible to generate random numbers using physical sensors?

I've heard about people using light sensors, geiger counters, and other physical sensors to generate random numbers, but I'm skeptical. Is there really a way to generate random numbers from taking measurements of the physical world (using an…
Harlo Holmes
  • 5,145
  • 1
  • 23
  • 20
13
votes
1 answer

How to enforce the struct bit order with the GCC compiler?

I was wondering if there is a GCC C Compiler directive that allows me to determine the bit order for packing of a structure? Something to the likes of: #pragma bit_order left The rationale for such a need is that I have the following…
Vern
  • 2,393
  • 1
  • 15
  • 18
13
votes
2 answers

Why does uint16_t make a difference here?

volatile uint16_t r; unsigned char poly = 0x07; unsigned char c = 0; r = (c << 8) ^ poly; When the code is compiled with gcc on Linux, r is 7. When the same code is compiled by Microchip C18, r is 0. Why? If I change it to: volatile uint16_t…
AndreKR
  • 32,613
  • 18
  • 106
  • 168
13
votes
5 answers

FreeRTOS: osDelay vs HAL_delay

While creating FreeRTOS application project with STM32CubeMx, there are two ways you can use to introduce delay, namely osDelay and HAL_Delay. What's the difference among them and which one should be preferred? osDelay…
ARK4579
  • 663
  • 2
  • 6
  • 16