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
0 answers
18 views

Azure NetX Duo: where can I find a driver compatible with my Ethernet PHY ADIN1200?

Context of my question I am trying to use Azure NetX Duo with a micro STM32F4. I'm using the following tools: STM32CubeMX version 6.7.0 In the STM32CubeMX I have installed the Package STM32F4 version ...
-4 votes
0 answers
61 views

Selling programmed PCBs [closed]

I want to purchase PCBs online and program them for specific purposes. I can sell the end product(like a wifi router). But i don't know how to find a client for only the programmed PCBs. Any advices?
2 votes
1 answer
77 views

How do I read multiple ADC channels from a SAMD21 configured in atmel.start?

I'm stuck with trying to read multiple ADC channels on a SAMD21 that I have configured using ATMEL.start. I am very new to Microchip Studio (Arduino convert trying to upgrade). The below code is my ...
0 votes
1 answer
122 views

ADC Multiple Channel without using DMA

below i give my code. here i using 2 ADC Channel and i getting first ADC channel value only. i need to read both ADC channel value. ...
0 votes
2 answers
49 views

PI negative controller output scaling to unsigned duty cycle

I am trying to implement a PI controller in C that outputs / controls a PWM's duty cycle on a microcontroller. The duty cycle that I can write to the certain PWM control register is limited to 10bit (...
1 vote
0 answers
60 views

STM8S I2C - Stuck while generating START condition

I'm trying to make an i2c scanner (just like the arduino one) for the STM8S005K6 but I can't seem to even generate a start condition for the communication to begin. I have to say, I've never used STM8 ...
  • 99
0 votes
0 answers
40 views

Understand the values of ADXL345 output by data sheet

I want to make step counter with ADXL345. I got the algorithm but I have a problem with the data sheet and the codes. First of all, I tried the all resolutions. For example if I use 2g my z axes's ...
0 votes
1 answer
57 views

Is there an alternative way to open file without its path in ELM Fatfs?

I want to open file files without their path in ELM Fatfs. I want to store a pointer or something and use that to open files or folders rather than their paths. This will save me alot of ram in a ...
0 votes
0 answers
21 views

Turning off the DEM 128064B SYH-PY display

I'm trying for warming up to turn off and on the DEM 128064B LCD based on the instructions defined in the datasheet page 12 section 10-1, but I nothing changes and the LCD is on always with all the ...
  • 1
1 vote
1 answer
80 views

How can I read an array of values from the ADC through a single channel on an STM32 (Nucleo F401RE)?

I am trying to work with the TCD1304DG Linear Array (CCD) sensor. I have configured the signal timings perfectly, as shown in the datasheet. Here is an image from the datasheet of the necessary ...
  • 73
5 votes
2 answers
718 views

Left shift confusion with microcontroller compiler

Using an STM32 uC debugger, and from binary 0111 I want to obtain 1110. And to do so, I use left shift operator as follow: ...
  • 1,355
0 votes
0 answers
59 views

How to set the SPI channel and read the measured values

I want to use the SPI of an STM32 to read several sensor measurements How can I set up a channel? I'm looking for it and using it, but I can't see it coming out properly. They say that you can use ...
  • 1
-1 votes
3 answers
117 views

Identifier "i" undefined [closed]

Hello I am using an MSP432 with CCS IDE, I am trying to use an array that points to the next integer in int x[i] ={} for a systick timer to increment the 16x2 lcd position while checking for if ...
0 votes
0 answers
100 views

Padauk Mini-c programming language

I want to program Padauk PMS171B ic using Padauk tech emulator and IDE. For this I wish to use mini-c but I don't find any related documents of mini-c. Is there any mini-c documents or example codes ...
  • 37
6 votes
7 answers
3k views

Why is a register initialised through bitwise operations instead of a binary string?

I'm learning microcontrollers, and have picked AVRs to start with. In many AVR tutorials I find the registers are initialised by performing some bitwise operations on the assignment, for example ...
  • 317
2 votes
1 answer
118 views

PIC18F4550 USART transmission keeps repeating

I used the following code to send out an USART asynchronous transmission of a string "AT\n\r" using a PIC18F4550. ...
2 votes
1 answer
88 views

I2C: no ACK from VCNL4200 (slave)

I am writing code for an ATtiny25 to interface with a proximity sensor VCNL4200 (slave address 0x51). The picture you are seeing is 9 clock signals signifying initial slave address along with write ...
  • 41
5 votes
1 answer
122 views

PIC18F4550 Asynchronous USART Baud Rate

I am trying to implement a USART routine to transmit a string using PIC18F4550. I intend to transmit the message at 115200 baud rate in asynchronous mode. My PIC18F4550 is running at 48MHz using 20MHz ...
6 votes
2 answers
431 views

PIC18F4550 CPU appear to be not running at external crystal frequency

I am trying to add a 20MHz external crystal oscillator to my PIC18F4550 microcontroller. The external crystal oscillator circuit connections to the PIC18F4450 is as below: The Datasheet suggest to ...
0 votes
2 answers
79 views

Questions related to the linker script

Hope all is well. Lately I've been studying linker scripts and I believe I got a gist of it enough to hold a conversation, however I can't find the answers I am looking for to some of the questions I ...
  • 1,381
0 votes
1 answer
52 views

AVR32 goes to unrecoverable exception when exiting interrupt routine

I'm using an ATUC128D3 microcontroller and have 5 switches connected to it. I have the GPIO interrupt configured to trigger on a falling edge and this works just fine. It enters the interrupt and the ...
-1 votes
2 answers
186 views

I2C with LED driver doesn't work

I have a circuit with a PCA9635 PWM LED driver. I want to turn on and off LEDs one after another, but my code does not work. I think the hardware is OK. My micro is a 16F887. Can you help me? ...
  • 1
1 vote
2 answers
107 views

STM8S ADC scan mode not reading all channels

I am using an STM8S105C6 MCU (user guide), specifically a discovery board, with Cosmic C and the standard peripheral library provided by STM. I have hooked up 2 signals to channels 0 and 1 of the ADC. ...
5 votes
5 answers
2k views

A question about using a 12-bit ADC value in embedded C

I'm using the following STM32's HAL function to read a 12-bit ADC value (0 to 4095) from a channel: ...
  • 1,445
2 votes
2 answers
107 views

Keil uVision Disassembly Window with ARM Microcontroller

I have a couple of probably simple questions for you all regarding disassembly from C code to assembly code. I am using Keil uVision as a programmer and debugger with a TIVA TM4C123GXL microcontroller ...
  • 1,474
1 vote
3 answers
212 views

Best way to interact with MPU

For the simplicity of the problem let's assume I'm using an Arduino. If, for example, I have this code: ...
  • 129
1 vote
1 answer
80 views

Retry function - I2C hung state handling PIC XC8

This may be a very borderline Stack Overflow question, but I decided to post here because I'm dealing with the I2C protocol for a PIC MCU in XC8. I'm learning how to talk with devices over I2C and it'...
  • 586
3 votes
3 answers
321 views

Raspberry Pi not reading rotary encoder accurately

I wish to write a program for my Raspberry pi that will print > when a rotary encoder is rotated clockwise and < when its ...
2 votes
1 answer
274 views

How to use a variable delay in Microchip PIC microcontroller (MPLAB X), without using floating point arithmetic?

I'm using a PIC10F220. For some reason, this delay works perfectly fine: __delay_ms(10); But, when I try to run a delay with a variable, it gets an error. This ...
  • 65
1 vote
1 answer
91 views

SD FIFO has no data available when mounting with FATFS

Issue I'm attempting to mount an SD card to my STM32F407 with Elm Chan's FATFS using SDIO and f_mount returns FR_DISK_ERR. The ...
  • 155
0 votes
2 answers
177 views

String array display on LCD using PIC MCU

I want to display certain messages on an LCD using a PIC MCU (16F887) and mikroC PRO for programming. I have stored the words in a 2D string array like in the following program: ...
0 votes
0 answers
29 views

Smartfusion2 soft CoreGPIO not working

I am having trouble getting the Digikey MKR board with a Smartfusion M2S010 soft CoreGPIO to run. I am using Libero SoC 2022.1 and Softconsole 2021.3. Softconsole has all its settings set as per the ...
2 votes
1 answer
138 views

Strange PORTA behaviour when using bitwise XOR in PIC microcontroller

I am trying to blink an LED using one of the PIC16F15214's timers and I have noticed a strange behaviour. I have started the project following the PIC1000 (TB3261) guidelines for writing C code and I ...
  • 21
0 votes
2 answers
86 views

PIC16F1517 timer0 does not work

I am trying to use Timer0 to control a blinking LED, but I am having some difficulties... the LED never turns on. I referred to this tutorial to set things up, but I still can't understand it, could ...
0 votes
1 answer
115 views

Alarm gets instantly fired on a Raspberry RP2040

I'm writing a program to manage the velocity of a motor that is remotely controlled. For security reasons, I want to stop the motor after one second after it receives a command if it doesn't receive ...
  • 145
0 votes
0 answers
66 views

Writing multiple buffers in ping pong mode tiva c

I'm trying to send multiple buffers each of 1k on EPI interface using uDMA on Tiva. I can send now two buffers in ping pong mode, but not sure where should I do the swapping between the buffers to ...
  • 177
0 votes
1 answer
112 views

ADXL355 Axes Overflowing

I am using an ADXL355 accelerometer on an ADXL355Z evaluation board and an RPI Zero W communicating over SPI, with datasheet here. I previously had it producing stable g values (with other issues as ...
4 votes
2 answers
536 views

STM32 applications hardfault after jumping from the bootloader

I am attempting to write a custom bootloader for a STM32F103C8Tx (64k Flash, 20k RAM variant) on a bluepill board. When the jump from the bootloader occurs the application immediately hardfaults on ...
  • 43
4 votes
1 answer
989 views

STM32 C function "strstr()" not working

I am trying to use an STM32 microcontroller (STM32L010C6T6 to be exact) to parse NMEA sentences from a GPS module over UART. I receive the messages fine, but run into issues when I look for specific ...
  • 179
0 votes
1 answer
94 views

Display all three colors (red/black/white) on an electronic paper display

I have been trying to drive a 2.13in electronic paper display (EPD) with an Adafruit nRF52 Bluefruit using the SSD1680 driver. I converted the image to C-code using an online image-to-C-code converter....
2 votes
2 answers
374 views

STM32 SD mounting returns error with SDIO

Overview I'm using a STM32F407ZGT6 and I'm currently trying to mount SD cards (MicroSD 32GB HCI and 256GB XCI picture) to the board using the FATFS library bare-metal. To handle low level I/O, I'm ...
  • 155
2 votes
0 answers
140 views

Which instructions do I use to be able to use UART directly on my STM32F107 microcontroller?

I've tried to figure this out on my own but after almost a week I'm still at more or less the same place where I started. So, I have an STM32F107 microcontroller on a board, which is linked to another ...
  • 31
2 votes
1 answer
109 views

Custom Memory Allocator - How to find the required alignment for a platform?

I'm building a portable arena allocator for embedded systems. Like for malloc, one of the requirements is to return a pointer aligned with the memory. The question ...
  • 611
2 votes
1 answer
106 views

I2C read() lost 1 bit

I try to use I2C to read data from ADS1110, the address of ADS1110 is seven bits, which is 1001 000. Writing data can only change the configuration register, which ...
-2 votes
2 answers
107 views

Drivers in C++ produces bigger assembly [closed]

I'm trying to figure out whether C++ is a suitable language for use in device drivers, like peripherals on Cortex-M3/M4. I started writing some drivers for GPIO and I noticed that it produces bigger ...
1 vote
1 answer
73 views

Noise reduction algorithm for an AC mains voltage measurement

I am measuring and displaying the mains voltage at six inputs with a 12-bit ADC. To make the calculation simple and fast I am only using 11 bits. I am sampling the 50 Hz sine wave at 20 points using a ...
3 votes
1 answer
134 views

Confusion with variable update in microcontroller programming

I use an STM32 microcontroller board and to summarize the question, in the following code inside the if clause the variable called ...
  • 3,859
-1 votes
1 answer
43 views

Problem with the output of the engine control signal

Program to control three DC motor levels and display speed (RPM) on a 7-segment LED using 8051. Use external interrupt 0 to read pulse from encoder. When compiling on keil C there is no error, but ...
  • 13
1 vote
2 answers
121 views

Keil C & 8051: DC Motor Speed Control & Display [closed]

I am writing a program to control three DC motor levels and display speed (RPM) on a 7-segment LED display using an 8051. I use an external interrupt to read pulse from encoder. When compiling, the ...
  • 13
4 votes
5 answers
565 views

Would writing to the same flash address reduce the lifespan of an MCU?

I am using an STM8 microcontroller. Since the vector table is in flash memory, I need to write to flash memory in order to create and use the vector table. Since addresses of vector tables are fixed, ...

1
2 3 4 5
32