Questions tagged [c]

C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language. from http://en.wikipedia.org/wiki/C_(programming_language)

Filter by
Sorted by
Tagged with
0
votes
1answer
20 views

How to set up clock for the STM32 Nucleo-64 with libopencm3/rtos

I was using this code from github on a blue pill. Now I would like to adapt it for STM32F401 on a Nucleo-64 board. I tried changing the GPIO to A7 and attaching an led (which lit up when I attached it ...
0
votes
1answer
22 views

Writing data into previously unwritten addresses in W25X10CL spi data flash

I am using a W25X10CL spi data flash to store data. Following is the data sheet for the data flash:- https://www.winbond.com/resource-files/w25x10cl_revg%20021714.pdf I need to read data from ...
0
votes
1answer
63 views

IC design future [on hold]

Looking around me in the electronics industry I get the feeling more and more that core IC designing will eventually be replaced by micro controllers, Soc's and programming in C. Are there technical ...
-1
votes
2answers
72 views

Can I use C++ stl in avr-gcc?

I have implemented C++ queue in my codes, those I run on my PC. Now I'm programming an ATmega128 micro-controller to implement a .c code. Can I use that ...
2
votes
2answers
247 views

avr-gcc keypad interfacing code problem

I have this function to read key press from a 4x3 key-board: ...
1
vote
3answers
125 views

Adding a const string identifier to at the start location of functions in C

I would like to add a const string identifier at the start locations of few functions. The reason is that I need to maintain a table of function pointers, the indexes of which are to be in a specific ...
-2
votes
0answers
39 views

timer as a counter for one second led toggle in stm8l

Can anyone explain how this calculation works in this timer configuration. I am using stm8l-discovery board and when I see the waveform, i get a graph of 1s for one complete on-off cycle. ...
3
votes
2answers
122 views

Back branches in code

While reading this file on software hazards this slide says: "No Back Branch in the Code" I wonder what does it mean? Normally when we write code in C-language then we don't actually do branching ...
0
votes
0answers
96 views

How to make an interruption?

I used to make interruptions on a STM32 the next way ...
0
votes
0answers
63 views

C - static struct global [migrated]

I have defined two structs in different files with the same name using the keyword "static". This means they should only be visible within those files. void function() in one of those files uses one ...
1
vote
3answers
61 views

Meaning of (*(__IO uint16_t*)PAGE0_BASE_ADDRESS) variable declaration

There is a variable declaration: uint16_t status = (*(__IO uint16_t*)PAGE0_BASE_ADDRESS); __IO is the precompiler directive ...
1
vote
1answer
57 views

Periodic timer not working as expected on TM4C123 MCU

I am starting to learn how to use timers/interrupts on the TM4C123 evaluation board (TM4C123GH6PM MCU). In this example I am configuring a timer to create 1 second delays to toggle an on-board LED on ...
5
votes
1answer
553 views

“Not enough RAM ” error in PIC16F877a

I have been trying to run the following code: ...
0
votes
2answers
172 views

Basic C Programming Question On Microcontroller

I think this question is ok in the electronics stack and not the programming stack (I hope). I have a simple code written in C, on a TM4C123 evaluation board. It uses the two on board switches to ...
1
vote
0answers
59 views

Write protection error on STM32F779II while erasing flash

I'm trying to erase flash for STM32F779II. The start up file starts with that section: ...
0
votes
0answers
47 views

avr/io.h don't include the appropriate avr/ioXXX.h file

I'm facing a problem on Eclipse IDE that when compiling my project (which has #include <avr/io.h>), the compiler includes ...
3
votes
1answer
96 views

Exiting interrupt routine in PIC16F18877

After executing the interrupt block, the execution halts and never returns out of the interrupt routine to the while(1) block in the main method. To check the functionality, I've written the below ...
-6
votes
1answer
134 views

Protect my C source code [closed]

I want to give somebody a project, but i used my own libraries on that and i want to protect my code. I'm currently working with C in STM32 systems. What can i do?
1
vote
2answers
58 views

Where should be defined a device specific ISR when making a static library?

Suppose I want to make a static library (.a file), which contains an ISR. That library should be used by many AVR MCUs, but each device has different ISR vector name, so it cannot be defined in .c ...
-2
votes
5answers
124 views

Bitwise operations in embedded C if button pressed on AVR circuit

I am using ATmega32 AVR microcontroller. I am confused about bitwise operation in embedded C. I understand (AND, OR, XOR, NOT) logic gates very well, but there is something that I don't understand: I ...
0
votes
0answers
43 views

Configuring the clock and LTCD stm32f7

I'm interfacing an LCD using LTDC. That LCD has a touch sensor that works for 400KHz. The touch sensor is interfaced using I2C. My problem is how to configure the clock for both to work. Right now I'...
7
votes
4answers
3k views

Embedded C - Most elegant way to insert a delay

I'm working on a project involving a cortex-m4 mcu (LPC4370). And I need to insert a delay while turning on compiler's optimization. So far my workaround was to move up and down a digital output ...
1
vote
0answers
64 views

Interfacing touch sensor with stm32f7

I'm having that touch sensor ST IC ST1633i. It's integrated into an LCD. I'm trying to interface with it, but don't know or understand the actual protocol. Here is the protocol So I'm trying to ...
0
votes
0answers
167 views

Embedded C - USB stack, arm-none-eabi-gcc settings and Matlab interface

I am using LPCOpen (latest realese available for LPC4370) and the usb stack provided within it. I need to build a simple FSM to control the mcu with Matlab and send data from Matlab to the mcu and ...
0
votes
1answer
70 views

dsPIC primary oscillator works for a few seconds or clock doesn't switch

I'm using a dsPIC33EP512MC806 and can't get the primary oscillator to work. The internal works fine, but if I switch to the primary it either hangs on Clock switch or goes in to the ...
0
votes
0answers
69 views

What scheduling should I choose for my program on a FreeRTOS system?

Not sure if it's the right place to ask but: I have a project (a 2-player game) made in FreeRTOS. The game has 3 tasks (Game Render, Joystick Task and a PC Serial Communication). Shared resources ...
0
votes
0answers
90 views

STM32 SDIO FATFS

I'm using SDIO (1-bit mode) with an STM32F429 Discovery board to read from and write to an SD card. The code below works, I've seen that it does, the problem is it seems to randomly choose when to ...
0
votes
1answer
96 views

Using pointer of a function's returned value

I would like to know if there are possibilities to change the following code: ...
0
votes
1answer
177 views

SPI Communication between ADXL345 and TM4C123GXL (TIVA C Launchpad) doesn't work as intended

I need to interface the TM4C123GH6PM based Microcontroller board TM4C123GXL (TIVA C Launchpad) with a accelerometer (ADXL345) by Adafruit. As, I am bound to use SPI communication and program on ...
0
votes
0answers
51 views

I can't open #include<pic.h> or <htc.h> in mikro c

I am trying to interface gps module with pic16f877a
5
votes
9answers
1k views

What is the simplest instruction set that has a C++/C compiler to write an emulator for? [closed]

I'm looking into writing a little software emulator that emulates/runs instructions. The easiest would be to invent my own instruction set, but I thought it would be more fun if I write an emulator ...
0
votes
1answer
43 views

Removing optimization changes I2C timing

I'm at using SAM E54 Xplained Pro to get temperature readings from a MCP9600 hooked up to a thermocouple over an I2C bus. I'm using Atmel Studio 7 with I2C drivers generated with Atmel Start. I'm ...
0
votes
2answers
53 views

Live variable view using openOCD and VScode

I really like using VScode + cortex debug extension + openOCD over Keil or Eclipse in embedded projects. Although i wasn't able to figure out how to set up live variable view, which you can set up ...
8
votes
2answers
936 views

PIC12F675 GP4 doesn't work

I'm using a PIC12F675 for a project, and everything works fine except one thing. GP4 does not work as digital IO. I've looked at the configs and the code a lot, but couldn't find anything. Config: <...
1
vote
2answers
96 views

Assigning a 16 bit number to two bytes of a buffer [closed]

Currently I have this out buffer that I am assigning values to like this: ...
1
vote
1answer
58 views

serial monitor error/crash

After typing C, microcontroller responds with # Next, I type k, microcontroller responds with #INFO: TWI master enabled Next, I type !, microcontroller responds with C after typing in the next ...
2
votes
1answer
53 views

PIC12F675 ADC not working properly

I wrote a code that takes an analog input from a potentiometer and controls the frequency of a clock pulse. So, the idea is to increase the frequency when I increase the pot and decrease the frequency ...
-1
votes
2answers
43 views

Converting signed hex integer to display negative decimal integer on terminal in C code

I am trying to take a signed hex number and display it on the terminal as a negative decimal number so that it can be easily read. I am having a hard time working through the logic on how to make this ...
0
votes
0answers
56 views

Error executing Application from BootLoader in STM32L475 (IoT Board)

The bootloader should jump to the Application after some verification. For now lets assume it straightaway jumps there. I am working on B-L475E-IOT01A2 device, which uses ARM M4 Cortex. I am using ...
8
votes
6answers
2k views

Concept of the static keyword from the perspective of embedded C

static volatile unsigned char PORTB @ 0x06; This is a line of code in a PIC microcontroller header file. The @ operator is ...
-1
votes
2answers
67 views

Why polling works rather than interrupts [closed]

I have several devices like for example connecting with ESP8266. I have tried to use the SPI with it with STM32F4. First I have tried to work with SPI interrupts, the result of the communication is ...
1
vote
1answer
141 views

Programming of ADC in PIC12F675: Not Working Properly

I'm new to embedded systems and I want to program a PIC12F675 for a project. So, the idea is that there is a switch. If the switch is off, the microcontroller normally outputs a clock signal, which ...
5
votes
3answers
2k views

Implementing an absolute value function in C

I am implementing a function to find the absolute value like this: uint16_t absolute_value(int16_t n) { int16_t mask = n >> 15; return ((n+mask)^mask); } ...
2
votes
1answer
84 views

Using Pointers to implement a filter

I'm trying implement a fairy basic filter, and right now I have just some simple test code for me to enter in values. It errors out on the line when it gets to where I call the function I have written....
1
vote
1answer
54 views

Lighting up LEDS via I2C Bus of a NeoTrellis 4x4 RGB Led Matrix

Many attempts to write to an i2c slave to make rgb leds light up have failed. The hardware in question is found at: https://learn.adafruit.com/adafruit-neotrellis There is an arduino library and a ...
-1
votes
2answers
137 views

STM32F4 series: what does the '->' operator? [closed]

Reading some C files related to programming an STM32F4 series Arm controller, I found the following instruction: ...
1
vote
2answers
48 views

How to put a breakpoint to after last line of a loop in GDB?

Consider the following loop: ...
0
votes
0answers
29 views

How to include new path in compiling qmk project

I have a running qmk project. I have used msys2 to produce the .hex file.Now I am trying to add MIDI functionality . when i add library folders such as MIDI . when I add include "midi.h" inside a ...
2
votes
1answer
46 views

How to include paths for the C compiler in atmel studio?

I have a folder project and it consists of multiple folder and .c and .h files what is the best way to include them all without including the individual folders?
2
votes
2answers
57 views

Problem in Clock Gating Control with ARM Tiva C

When I access a peripheral register (such as a GPIO port) just after enabling the clock gating of the peripheral, a hard fault happens. For example: This code doesn't work (generates a hard fault): <...