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
1 answer
61 views

Why is no data written to the I2C bus using this PIC12LF1822 code?

I am trying to implement a basic I2C Master write sequence for a PIC12F1822 Microcontroller. I am programming the device using the PICKit 3 programmer. I have heavily simplified the code to isolate ...
BlueShoes's user avatar
0 votes
0 answers
49 views

Can I send and receive multiple structs in message queues in IPC mechanism? [migrated]

I'm exploring message queue implementations in [insert programming language], and I'm curious about the possibility of sending multiple structs through a message queue. Specifically, I would like to ...
Subzee's user avatar
  • 15
0 votes
0 answers
51 views

STM32F4 HAL_BUSY Flag raised, not able to be cleared

I have a LM75A that I communicating with over I2C, using the STM32F4x Hal. I am using a STM32F446RE board. My code is abstracted in multiple layers to allow for some modularity. LM75A_Driver.c and .h ...
Liferafter's user avatar
1 vote
1 answer
33 views

Dynamically change PWM frequency on NRF52810

I'm using a NRF52810 to control an LED load and need to ramp up PWM frequency over the span of 6 seconds, like 0-1s : 6Hz, 1-2s : 7Hz, 2-3s : 8Hz, 4-5s : 9Hz, 5-6s : 10Hz. At the moment, this is how I ...
roaibrain's user avatar
  • 209
0 votes
1 answer
35 views

Is it possible to have a C language model of design in same simulation as the RTL itself and compare their outputs?

Assume that an algorithm exists in C language. It needs to be implemented in VHDL. One way to compare the two is to apply stimulus from file to model using another program or script and then store the ...
gyuunyuu's user avatar
  • 2,023
2 votes
2 answers
115 views

MCU slave receiver I2C shifts incoming data by one bit when replying with ACK

I am communicating with I2C/TWI between a MCU (Atmega328p) as Slave receiver and the raspberry pi 5 as master transmitter. I2C is at 100kHz configuration (the slower the Rpi5 can go). I have an issue ...
Christianidis Vasilis's user avatar
2 votes
0 answers
72 views

STM32f030 Inconsistent clock

I am trying to write my own microsecond delay function for an STM32f030R8t6 by using the counter function on Timer 3. The first time I power the microcontroller up after flashing the delay works ...
Eric14003's user avatar
1 vote
2 answers
135 views

I2C peripheral fails after a single transaction

I am using this library to sample some sensors over the I2C bus using the PRUs on the Beaglebone Black. It seems as if only the first transaction works correctly, after which the library seems to only ...
lrdewaal's user avatar
0 votes
0 answers
74 views

STM32 FreeRTOS StreamBuffer doesn't work

I am testing RTOS's StreamBuffer and it doesn't receive what it sends: ...
KlimDuda's user avatar
0 votes
1 answer
130 views

How to format data properly before using CDC_Transmit_FS?

I am using STM32CubeIDE to program 12 bit ADC(P/N = ADC128s102) which has 8 bit of control register and return 12 bit in MISO. Following is scope result. I am able to return some data which I think it ...
Alia Sana's user avatar
2 votes
1 answer
242 views

STM32 - HAL_UART_Receive first byte is always zero

I am implementing communication between Nucleo-F072RB board and an evaluation board with TI BQ75614 BMS IC. I have succeeded to communicate with the IC using 1 Mbps UART interface, successfully ...
block3r's user avatar
  • 41
1 vote
2 answers
138 views

STM32 USB Full Speed and card reading causes slow USB speed

I-m trying to accomplish best USB speed through STM32H743 MCU to PC. First of all I was testing just receiving data. I was sending sending 8192 bytes from MCU to the pc without any other tasks, and ...
KlimDuda's user avatar
1 vote
1 answer
74 views

STM32F407 PLL config not producing 1ms SysTick

I've a bare metal PLL setup for my STM32F407 which should generate a 168MHz system clock. However for some reason the 1ms SysTick interrupt is orders of magnitude off the grid. The math works out on ...
Michael's user avatar
  • 113
1 vote
1 answer
57 views

Where is SX1268's frequency calculation formula shown in the datasheet?

The SX1261/2/8's datasheet describes the function to calculate the frequency to set the IC: Re-arranging the formula to find out the 4 bytes to send gives: \$ RF_{Freq}= \cfrac{RF_{frequency}*2^{25}}{...
Christianidis Vasilis's user avatar
-1 votes
2 answers
198 views

Possible FPU error

...
user avatar
0 votes
0 answers
45 views

Identifier whose declaration cannot be found. TRISbits

Currently trying to program a PIC32MZ2048EFM144. I'm new to PIC programming, and I'm currently attempting to set pins J7, 3, and K7 as outputs and set them to a high state. However, I'm encountering ...
Sean 's user avatar
  • 11
0 votes
1 answer
70 views

Capture/compare interrupt flag resetting without reading the CCRx

...
user avatar
0 votes
2 answers
105 views

Unable to resolve TRISBbits even with xc.h included

I am new to PIC programming, and I am trying to blink an LED using the PIC32CM MC00. I understand I must declare them as inputs or outputs, but the IDE I am using (MPLAB) keeps giving me an error when ...
Sean 's user avatar
  • 11
0 votes
1 answer
123 views

Trying to read temperature, but always reading 655.000000 from Si7021 sensor connected to STM32 NUCLEO-F746ZG via I2C

I am trying to read temperature and humidity data from the Si7021 temperature and humidity sensor on an STM32 NUCLEO-F746ZG over I2C, and then send it over UART to be viewed on a computer. After ...
p1unge's user avatar
  • 1
1 vote
2 answers
263 views

Can you deliberately damage RAM using pointers?

Can one deliberately cause physical damage to RAM using C++ and its implementation of pointers? What about segmentation faults? Can they cause any damage? Example: trying to access a non-existent ...
ben's user avatar
  • 13
0 votes
1 answer
102 views

Can't debug a PIC24F04KA200 using a MPLAB Snap debugger

I'm working with a PIC24F04KA200 in MPLAB X IDE v6.05 and debugging using a MPLab Snap debugger. Programming in C. I can program the device perfectly fine. When I want to debug the program I need to ...
Royginald's user avatar
0 votes
2 answers
189 views

What does the frequency of a microcontroller mean?

I'm working with STM32 board which a microcontroller is embedded. This MCU seems to work within 72MHz max. Now if I make a C code, does that mean each simple instructions would be done within 72MHz? ...
Classy Fied's user avatar
0 votes
1 answer
67 views

Encoder signal reading Arduino

I have a quadrature encoder both connected to the Interrupt pins on my arduino. I want to read the encoder values in the range of 0-255 with increment in the clockwise direction and decrement in the ...
dreamcoder's user avatar
0 votes
0 answers
30 views

LSM6DS3 gyro raw to degrees per second conversion error

I am using LSM6DS3 for one of my projects with Nordic nrf52840 along with Nordic SDK. I am trying to read the gyroscope and according to my understanding the gyroscope value should not exceed the full ...
EngineeringArtist's user avatar
-1 votes
2 answers
140 views

What's a good way to learn microcontrollers without magic? [closed]

I know software (C, C++, POSIX, assembly) and would like to learn microcontrollers at a low level, down to digital circuits. I don't want to use any tools that obscure the internals, such as Arduino, ...
SRobertJames's user avatar
1 vote
1 answer
151 views

How do I use CMSIS without a GUI or IDE?

I have a bare metal STM32 C project working on a NUCLEO-F446RE. To learn about MCUs, I did not use any code generators or IDEs, but created a simple Makefile, linker script, start up C code, and <...
SRobertJames's user avatar
5 votes
2 answers
912 views

Loading LSB first or MSB first?

I am trying to create a delay function similar to builtin __delay_ms() in MPLABX IDE PIC18F4520. The question is if I write the LSB first to the TMR0L register, I ...
Madhan Gasikanti's user avatar
0 votes
0 answers
56 views

Problem in code while interfacing PIC24 with 25AA256 EEPROM

I have been trying to interface a PIC24FJ128GA010 with a 25AA256 EEPROM using Proteus and Serial Peripheral Interface (SPI). I wrote a C code and configured everything and all pins but since I self ...
P-Em's user avatar
  • 13
1 vote
0 answers
31 views

Help in system initialization and clock configuration of MSP430F427A MCU interfaced with custom LCD

When I debug the code, the LCD refreshes rapidly. I am not confident with the correct system clock configuration to use. Moreover, after debugging, in release mode, nothing displays on my LCD nor the ...
Bravo's user avatar
  • 21
0 votes
1 answer
89 views

Variable resets to zero when entering an ISR C Atmega 328P

it happens only with "prova", sell, it happens with every variable i try to modify in the Interrupt service routine. The new value remains after exiting the rputine but when entering again ...
Albuereta's user avatar
0 votes
1 answer
80 views

Proteus error about coff format. (Coding in C to program a PIC microcontroller)

I am trying to make a code to interface a PIC24FJ128GA010 with a 25LC256 EEPROM. This the following code: ...
P-Em's user avatar
  • 13
0 votes
1 answer
136 views

Get Input Text from Console on MicroBlaze Softcore

My experience with writing embedded C is pretty limited so there will probably be a simple solution to this question. I am using a Microblaze softcore on a basys 3 FPGA development board and will have ...
David777's user avatar
  • 1,578
-3 votes
2 answers
89 views

Embedded C vs. General Purpose C [closed]

Can somebody list all the differences between Embedded C for intel 8051 and General Purpose C?. Where can I find the standards of Embedded C?
Philip's user avatar
  • 19
3 votes
1 answer
130 views

How can I dynamically preload the EEPROM on a PIC microcontroller

I'm trying to set up code to preload the EEPROM of a PIC16F628A with the necessary data depending on the value of one #define, so the uC is ready to be popped into ...
fpp's user avatar
  • 159
0 votes
1 answer
156 views

FreeRTOS LED Toggle

I have worked on bare metal programming so far. I want to make a step into RTOS. I have a Nuvoton made M032SG8AE MCU.I want to port FreeRTOS to it. I created a project and ported heap_1.c, port.c, ...
Bowman's user avatar
  • 329
1 vote
2 answers
79 views

Not having a PORTAbits.RAx on ISR breaks my code

I'm working on a 433MHz RF reciver code for a PIC16F628A using a cheap 433MHz receiver. The catch here is that I'm only able to use RA4 for the RX, and because of that i had to use timer2 (because the ...
fpp's user avatar
  • 159
0 votes
1 answer
71 views

Access individual bits of a variable

I'm making a code on a PIC16F628A running at 4 MHz that receives the serial bitstream of a 433 MHz remote. The catch here is that I'm forced to do some rather questionable stuff because the pin ...
fpp's user avatar
  • 159
0 votes
0 answers
236 views

PID control with PIC microcontroller

I'm relatively new in C program ( I'm using MPLAB X IDE XC8 ), and first time trying to make a PID control, using a PIC16F15223 This is what I want to make: The pic has an analog input that reads a ...
samuel mattio's user avatar
0 votes
1 answer
131 views

How can I create variables like registers?

I'm currently working on a small home alarm system that runs on the PIC16F628A microcontroller. It's not the first time I came to a project with the idea of using my own custom created registers that ...
fpp's user avatar
  • 159
2 votes
1 answer
68 views

Reading and writing from the BMP180 E2PROM

I have been trying to practise writing drivers using the I2C protocol and as a result, I have checked the drivers written for the BMP180 temperature sensor by Adafruit and written my own some time ago ...
Suva23's user avatar
  • 33
0 votes
0 answers
161 views

Printf retarget on STM32 with CubeMX

I'm using STM32F7xx for my project where I use VS Code text editor in combination with CMake project build. I also use CubeMX for code generation. For a record I have already examined all the answers ...
MucaGinger's user avatar
  • 2,380
2 votes
1 answer
78 views

PIC- Analog Digital Converter ( MPLAB - C )

I had a problem with some code where I had to convert analog to digital using my PIC24HJ128GP506A microcontroller. As you may know, the microcontroller uses Successive Approximation for conversion, ...
O_DERE's user avatar
  • 25
0 votes
1 answer
58 views

PIC32CX BZ2 register names don't match documentation

Preamble: I use MPLABx 6.1, the compiler (XC32) is installed and functions correctly, the correct device (WBZ451 with PIC32CX) is selected and xc.h is included. I have about 15 years experience with a ...
Gambanishu Habbeba's user avatar
0 votes
1 answer
146 views

ATtiny10 sleep mode

I have a very basic ongoing project that involves 8 LEDs, push-button tack switch with 10 kΩ pull up resistor, and an ATtiny10 microcontroller. The entire system is powered by a coin cell battery with ...
Warranty_void's user avatar
0 votes
0 answers
47 views

Not reading the start signal from DHT22 sensor

I'm trying to implement a program from scratch to read from a DHT22 sensor connected to an ESP-01 as a learning exercise. I am basing my implementation on the from adafruit DHT library. Following is ...
kovac's user avatar
  • 473
1 vote
0 answers
227 views

How does the incremental form of the PID controller work?

I have a question regarding the features of the so called incremental (velocity) form of the PID controller. As far as I understand this form in correct manner it can be described via this pseudocode <...
Steve's user avatar
  • 1,071
0 votes
1 answer
128 views

Interfacing HD44780 LCD with PIC16F690 in C (XC8 compiler)

I am trying to interface a PIC16F690 with a HD44780 LCD module, in 4-bit mode. My connections are as follows: ...
Al2110's user avatar
  • 103
1 vote
0 answers
55 views

How can I add an ADC sensor on STM32WL pre-application?

I am trying to read ADC values from a microphone. I am using the FFT to get 100 Hz to 2 kHz or more to detect tones. In my project, I can use DMA to get ADC values and then I use DSP CMSIS. I can do ...
mrneedshelpalot's user avatar
0 votes
0 answers
60 views

RPi Pico and OV2640 using C/C++ SDK

I am trying to connect an OV2640 with RPi Pico using the C++ SDK to get images over UART. I found this library but I have been on this for days but cant figure out the PIN connection. I tried reading ...
Mihir Bhatia's user avatar
0 votes
0 answers
19 views

STM32WL55JC1 sampling rate is different

I am using STM32Wl55JC1. STM32WL55JC microcontroller multiprotocol LPWAN dual-core 32-bit (Arm® Cortex®-M4/M0+ at 48 MHz). I am trying to do tone calculator. I am using DSP, ADC, DMA and timer for ...
mrneedshelpalot's user avatar

1
2 3 4 5
33