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
2
votes
1answer
35 views

ASCII value error during communication (UART) in AVR

I am trying to implement following program in Atmega328P. ...
-3
votes
0answers
20 views

Dynamic call for Variadic functions (Arduino) [closed]

How can we make this code work for Arduino? Thank in advance. ...
0
votes
2answers
72 views

Using SPI to manipulate Flash Memory (Code in C)

for a couple of days i have been trying to write a C code that writes to a flash memory via SPI. I already have a code that writes characters into flash. Now i wanted to expand on it and write integer ...
1
vote
1answer
81 views

EEPROM returns 0 while trying to read anything

I'm using a CC2652r to try to read and write to an MX25R8035F EEPROM using SPI. I'm using the build in SPI driver to try and communicate with the EEPROM but while the drivers says it succeeded the ...
0
votes
0answers
10 views

BlueNRG-2 from STMicroelectronics Range Problem

I have configured my Bluenrg2 with the help of a Bluenrgsdk module with Data Length Extension of 251 bytes and ATT_MTU as 247. I ...
0
votes
2answers
48 views

Splitting Variable of integer into 2 Set

I have actually 2 issue in code. 1) variable declaration. I have declare variable unsigned int Top_Display=0; if assign Top_Display=0123 display shows 0083 if assign Top_Display=123 display shows ...
0
votes
1answer
39 views

Displaying data In Hour /min/sec

I am using PIC16F886/4 MHz crystal/1 ms timer Interrupt. I have variable named Topdisplay and bottom display. When top display == bottom display the process should stop. Topdisplay Setvalue ...
-3
votes
0answers
21 views

PLL in Tracking for GNSS behaviour

I'm doing work on SDR for GNSS and I'm tracking the signals I/Q using PLL. The calculations for the PLL is done like the following for error estimation: ...
0
votes
1answer
51 views

Slow FIFO read from LSM6DS3

I have been trying to read FIFO buffer from LSM6DS3 inertial sensor via i2c. The processor will read LSM6DS3 buffer every 20s so the FIFO will contain approximately 3120 bytes of accelerometer data. ...
0
votes
0answers
26 views

How to program CH559 to use one USB as master the second one as slave?

I have found a video in youtube which uses CH559 to connect a normal mouse/keyboard or both at the same time in order to make inputs to arduino. These inputs can be visualized from the OLED ...
0
votes
1answer
81 views

Problems with UART in ATmega

I've been programming my atmega 328p to automate my coffe machine. The timer is set using the bluetooth module HC-06, or by a set of configuration buttons that I'm gonna develop yet (the full code is ...
0
votes
1answer
45 views

STM32F411 - Timer interrupt not firing

I setup TIM3 on my STM32F411 using the following code: ...
2
votes
2answers
28 views

AVR gcrt1.S behavior

So basically i have decompiled unoptimized simple program and saw that it runs through gcrt1.S, and i dived in to assembly language and tried to understand what exactly it does. here is my code and my ...
0
votes
0answers
31 views

How can i get a new string from other strings without simply concatenating them, in C programming? [migrated]

I need some help in C programming, please. I want to generate a new string from other strings without using concatenation functions or crypto algorithms (md5, rsa, aes, sha256). Specifically, i want ...
0
votes
0answers
55 views

System on Chip (SoC) ARM + FPGA (ZynQ-7xxx) - code design methodology

So far I've only been working with either ARM processor or FPGA/CPLD device separately. I.e. either I used a dedicated toolchain to generate binaries for a processor system from a C code, or I used a ...
0
votes
0answers
36 views

nRF24L01+ radio module - IRQ problem

I have a problem with IRQ interrupts. After successful transmission, the nRF24L01+ sets the IRQ pin low (about 19 ms), but sometimes doesn't return to high: After every packet transmission (tx ...
0
votes
2answers
73 views

Misra C or other code standard compliance in TI CCS

If I need to do Static Code analysis of my code or check for Misra C compliance for my code in TI's CCS for MCU RM57 then how can I do that? I can see 'Code Analysis' in the project preferences but I ...
1
vote
3answers
111 views

Stuck with deciding the location and the type of variable declarations for this MCU code

I'm using ATmega328P with Atmel Studio. In the following code I declare almost all the variables inside the while loop: ...
7
votes
5answers
3k views

How can I estimate the speed of this code section for this microcontroller?

I'm using an ATmega328P to read the state of a digital input by using the following code section written in C (there can be alternative ways, but this is an example). ...
1
vote
3answers
122 views

How to access GPIO pins on Atmega with memory mapping?

I'm programming the Atmega328P in embedded C. I'm going to use 16 pins for turning on LEDs, and I have to use PORTB, PORTD and PORTC for this. I would like to just iterate a pointer so I can turn them ...
0
votes
1answer
62 views

How to get started with AVR Microcontrollers? [closed]

I have an AVR ATMega32A Microcontroller, a Programmer that supports my microcontroller, a breadboard and some electronic stuff ...
0
votes
1answer
93 views

Two switches and two LEDs using 8051

I am trying to work around a circuit and my requirement is as follows: - There are two inputs and two outputs. Each input controls an individual led. I am writing a code for this requirement using a ...
21
votes
7answers
5k views

C - wrapping globals in a struct?

A firmware style question concerning C. I have some legacy code I am tidying up. One of the nasty features is global variables being scattered through the source files. I can make a few of them ...
0
votes
1answer
97 views

Removing delay in UART communication layer

I'm writing to a UART Device. So I'm doing the following: I'm transmitting the message as follows: ...
0
votes
1answer
69 views

STM32 TIM2 PWM and TIM 5 basic mode simultaneous output issues

Using an stm32f411re I want to generate a PWM of 20% Duty Cycle with a period of 200uS and simultaneously I want a basic timer to be ticking in the background that sends an interrupt every 70uS (that ...
2
votes
2answers
50 views

PIC when generating a PWM signal does the used timer throw a overflow interrupt flag?

I'm trying to make a 10kHz PWM signal with a PIC18f25k50. Which is generated like the following diagram. I configured timer2 at 750kHz which means if I set PR2 ...
0
votes
2answers
54 views

Data send only in MCU based I2C Slave

I want to know that is it possible that a Slave I2C device which is a 32-bit MCU, for example STM32F407, I write its I2C data send function and send data through it after every 1 sec? I am asking this ...
0
votes
2answers
88 views

Interfacing Atmega 2560 with 74ls240 inverting buffer

I am trying to light up the 7 segment display using inputs to the Port B pins, causing output on the Port k pins, which are inverted using the 74LS240 chip. The Arduino is correctly outputting the ...
0
votes
1answer
74 views

PIC16F57 timer how to trigger an interrupt

I'm trying to make a simple delay turn-on function using Timer0 inside the PIC16F57 itself.All the example I can find on internet mostly come with build-in interrupt function which the PIC16F57 doesn'...
0
votes
0answers
31 views

DSPIC33 - Simple Code for SPI

Unsuccessful, we have been trying to: Using our DSPIC33, set up the SPI slave device which expects mode 0 (clock polarity = 0 and clock phase = 1. Remember that microchip devices let you set clock ...
3
votes
2answers
312 views

Reading interrupt safe ring buffer

I have a piece of code here that was generated by Atmel START Wizard. It setups a UART and it also creates a ring buffer for reading data. This is the code that reads data from the buffer: ...
1
vote
1answer
104 views

Sending a double type value over CAN Bus

I need help to send a double value using a CAN Bus. I am working on a eletronic traction control and i need to send, by a CAN bus, the calculated values of speed of wheels. The problem start when the ...
0
votes
1answer
31 views

XC8 Pic function ptrs looks optimized away

The problem is - new_handler in OWT_RegistrateHandler always equals &_DummyHandler and i ...
1
vote
1answer
82 views

FreeRTOS: Task Creation Problem

I am creating 2 tasks, one controls a keypad the other a temperature sensor. Each task works individually. However when I try to create both task it does not seem to create the task, it keeps looping ...
0
votes
4answers
127 views

Why am I getting an error when setting the TRIS registers with PIC?

I am new to PIC programming, and I am trying to blink an LED using the PIC10F206. It has 4 I/O pins. I understand I must declare them as inputs or outputs, but the IDE I am using (MPLAB) keeps giving ...
0
votes
0answers
93 views

Proteus failing to load .elf file for arduino simulation?

I've been writing code for an alarm clock based on the Arduino Uno, and then uploading it to a simulation in Proteus to test it out. Everything was working perfectly until I decided to try changing ...
4
votes
3answers
406 views

Approach for receiving unknown length of data

I'm using STM32F407 and I would like to receive unknown length of data. My current approach uses a fixed known size to receive the data from UART5. How do I change it to receive unknown length of ...
0
votes
1answer
66 views

pic16f887 PORTA simple or not?

My project with PIC16F887 has strange behavior that I can't explain. This simple c program (I removed the unimportant part) on a PIC16f887 does something weird. Port A is partly switching on en off ...
1
vote
3answers
152 views

Counting pulses using Arduino Uno

I am trying to count pulses from a waveform generator using an Arduino Uno. The waveform generator is set at the following settings: Waveform Type: Pulse Freq: 20 Hz (50ms) Amplitude: 3.0 Vpp Offset: ...
0
votes
1answer
75 views

HAL Recieve data only when I transmit data again

I'm using STM32F407 discovery board with a GSM Module. When I'm transmitting and on receiving data, I get zero data, but on the next transfer, I see that the data that I have to receive is filled out....
0
votes
1answer
40 views

using a sim module for sending more than 1kbytes throught htpps

I'm going to use that module for internet connection and to send data to a server. https://www.waveshare.com/wiki/SIM7020E_NB-IoT_HAT My question is I know that TCP stack only supports max of 1200 ...
1
vote
0answers
33 views

PIC16F7X I2C Issues With 24AA01/24LC01B EEPROM

I have an existing PCB that is no longer supported by the manufacturer and has been plagued with software issues for years. So i don't have much control over how the board is laid out and what ...
0
votes
0answers
35 views

bio-impedance with AD5933

I want to measure the human tissue impedance in vitro by using AD5933. According to circuit given in application note by analog devices https://www.analog.com/media/en/technical-documentation/...
0
votes
0answers
40 views

Drawing a single pixel using DMA2D

I'm trying to draw a single pixel using DMA2D. I did the following code it's not working at all. LCD Display Width is 320, Height is 240. I assumed a 1x1 pixel rect as a pixel. ...
0
votes
1answer
80 views

What is the problem in my timeout implementation?

I'm trying to use a DHT22 (temperature and humidity sensor). Here is its datasheet: DHT22 Datasheet In first few seconds, I can get values. But after a while it gets stuck in here: So I tried to ...
0
votes
1answer
25 views

AT90CAN128 iocanxx.h vector numbers

The vector numbers in this header do not match the vector numbers in the manual AT90CAN128 doc7679 pdf Section 8.1 They appear to be one position out Can anyone advise on which is correct?
2
votes
2answers
139 views

How can I map bits in a byte to turn on or off a pin?

I have a byte of data as input and each bit represents the state of an led. The pins that control the leds are spread out and on different ports. I have C code that changes the state of 6 leds. ...
1
vote
1answer
56 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
39 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
29 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 ...

1 2 3 4 5 26