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
1
vote
1answer
38 views

STM32F103CB Timer update interrupt not working

I am trying to setup the timer update interrupt of a stm32f103cb. My setup and interrupt code looks as following: ...
0
votes
1answer
24 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
23 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
116 views

Where MOSI is triggered low or high

Sending and Receiving Data //Function to send and receive data for both master and slave ...
-1
votes
2answers
74 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 ...
1
vote
3answers
127 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 ...
0
votes
1answer
65 views

IC design future [closed]

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 ...
2
votes
2answers
250 views

avr-gcc keypad interfacing code problem

I have this function to read key press from a 4x3 key-board: ...
17
votes
6answers
50k views

How do I use the printf function on STM32?

I am trying to figure out how to use the printf function to print to the serial port. My current setup is STM32CubeMX generated code and SystemWorkbench32 with the STM32F407 discovery board. I see ...
4
votes
4answers
2k views

Implementing an I2C buffer in C

I'm implementing a read-only I2C slave on a PIC18F4620. I have made a -working- ISR handler for the MSSP module: ...
0
votes
1answer
56 views

Translate from AVR pgm_read_byte to normal C array manipulation in STM8

I am trying to translate a couple of lines of code from AVR space data to STM8 normal C data manipulation. As you should know, AVR has a program space which can storage data for read only operation, ...
-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 ...
3
votes
4answers
10k views

Arduino Code - simple if, else statement?

Basically, I have two led lights connected to pin 2 (led 1) and pin 3 (led 2), and I want led 2 to light up every time led 1 lights up, and turn off every time led 1 turns off. My code: ...
0
votes
1answer
181 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
96 views

How to make an interruption?

I used to make interruptions on a STM32 the next way ...
0
votes
1answer
183 views

Deferential CVD waveform in pic 18F45K50

I am using pic 18f45k50 for capacitive touch button using a deferential CVD. My capacitive button works. However I am not able to get the standard deferential cvd waveform suggested by microchip. ...
0
votes
1answer
347 views

I2C ADV7511 communication

I am currently trying to communicate via I2C to HDMI transmitter ADV7511 from Zynq 7000 Soc, I used this example as a reference for start, but yet without success, program get stuck in function ...
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
554 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 ...
0
votes
2answers
54 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 ...
0
votes
1answer
289 views

How to read potentiometer input from dsPICDEM MCLV-2 Dev Board - dspic33

I have very little microcontroller knowledge so please bear with me. I am trying to figure out how to use all of the inputs on the dsPICDEM MCLV-2 Dev Board. Specifically, how do I read the ...
-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
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 ...
1
vote
1answer
311 views

Interfacing keypad with 8051 microcontroller in Proteus

I am trying to simulate this project in Proteus using keil C. We are basically interfacing 4x4 keypad with 8051 microcontroller. This is the code for the project: ...
0
votes
2answers
344 views

PIC18LF24K40 I2C read and write using Polling method

I'm trying to implement read and write routines using Polling method for a PIC18LF24K40, write seems to work, but not read. I cannot figure out what i am doing wrong. EDIT: Reading a byte stored in a ...
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 ...
4
votes
1answer
4k views

How can I log information from code in IAR Embedded Workbench to a log file?

I'm trying to develop an application for the NXP LPC1788 microcontroller and I would like to be able to log formatted strings at arbitrary points within the source code to a log file in a way that has ...
0
votes
1answer
2k views

generating different duty cycle on two different pins of same pwm timer STM32 Nucleo

I used STCube to generate my code in order to get a different duty cycle on two different pins of the same timer on my Nucleo F446ZE board. It works for the most part, both pins have the same ...
0
votes
2answers
100 views

PIC simple LED ON not working

I have been trying really hard to just get a PIC to turn on an LED, i know its super simple but for some reason i just cant figure out, its not turning ON! I am using an old fashion PIC16F877, I am ...
1
vote
1answer
367 views

Stm32 C - Stepper motor start after 1 minute

I wrote a stepper motor driver with the use of DMA and TIM1. I accelerate the signal using the so-called Ramps. I calculate the times and load them into the DMA table and pass them to the TIM PERIOD ...
0
votes
3answers
158 views

PIC16f88 not debugging

Disclaimer, i am more or a hardware designer and not so much a coder, i can code but i'm not the most proficient at it. I have a project I'm working on that has a portion of the code that appears to ...
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 ...
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
votes
1answer
114 views

STM32 interrupt from Matlab Code

I'm using the STM32 MAT plugin and embedded coder for Simulink to generate C-Code out of my models to compile them onto an STM32F4. As IDE I use TrueStudio and for my MCU Configuration I use CubeMX. ...
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'...
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 ...
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
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
1answer
142 views

Unable to interface BeagleBone Green with MCP3008 ADC using SPI

I am unable to interface MCP3008 with BeagleBone Green. I am trying to set communication in mode 0 (CPOL=0 CPHA=0), the built in frequency in dts is set to 1MHz. Things I have tried: Enable device ...
0
votes
0answers
94 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: ...
2
votes
1answer
3k views

BeagleBone Serial Communication

I have a problem seeing characters written in /dev/ttyS8 on my PC terminal with this C code: ...