Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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)

0
votes
1answer
60 views

Problem copying part of char * in a new char * [closed]

In order to show text in a touch display (RA8875 with the registers programmed using a TIVA C board, that's why I though it was better to ask here than in other forums), I am trying to work with a ...
0
votes
2answers
68 views

Problem designing a PIC to just print on the LCD hello world

I have programmed a PIC before. The function of this PIC was to display Temperature based on an NTC, my little cousin yesterday messed with the wires and now it is not printing anything on the screen, ...
1
vote
1answer
35 views

can't read push button value in dsPIC33

This is the first time I work with a PIC microcontroller. I am using the Clicker 2 for dsPIC33 board (dsPIC33EP512MU810), and so far I am trying to implement a basic programme for testing the board. ...
-3
votes
0answers
32 views

Displaying value on 2 line 4 digit 7 segment code [on hold]

I have using arduino Uno . I have used serial in parallel out to display the parameter. Here i am pasting the piece of code. Totally i have 8 digit of 7 segment display.Dissect & Dissect2 split ...
3
votes
3answers
78 views

STM32 CAN bus receive interrupt is sometimes not fired, and CAN transmit sometimes times out

I have two STM32 boards connected via a CAN bus. They periodically transmit a message to each other. For some transmissions however, HAL_CAN_Transmit returns with ...
0
votes
0answers
23 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, ...
0
votes
0answers
42 views

Creating a library for arduino [migrated]

I found a really nice 24 bit I2C adc which was fairly cheap as well (ADS1219) but as far as I could tell there are no libraries for it so I decided to make my own. I have managed to write functions ...
0
votes
2answers
70 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 ...
0
votes
1answer
45 views

How to write more than one page at once in Winbond W25Q32JV

I am using Eclipse IDE for firmware development. I am using Quectel MC60 module with Winbond W25Q32JV (4 MB memory). The thing is that I am able to read/write single page. I am facing issue with ...
0
votes
1answer
80 views

Call member function from interrupt in STM32 [closed]

I have created a new STM32 project using cube. I have changed main.c to main.cpp and enabled ...
2
votes
2answers
81 views

Just read a Register

I am using a STM32F103CBT6 as I2C Master. After sending the I2C Adress of the Slave I need to clear the Addr bit in the SR1 register. The Datasheet states: "ADDR: Address sent (master mode)/matched (...
1
vote
2answers
151 views

Combine C and C++ in STM32 application development [closed]

Generally, developing embedded systems applications is based on abstraction. We expose some functions from lower layers that can be used in the application layer. My question is: Can I develop the ...
0
votes
0answers
26 views

CC2530: adapting AVR/pgmspace.h for Zigbee

Goal: Adapt ENC28J60 codes written for ATMega328p (http://tuxgraphics.org/electronics/201204/embedded-ethernet-client.shtml) for CC2530. Problem: No equivalent library for AVR/pgmspace.h available ...
1
vote
2answers
39 views

PIC32MZ, MPLAB Harmony with I2S hangs after adding extra function

I have referred http://microchipdeveloper.com/harmony:i2s-tutorial and am able to configure the I2S and read continuous data from a microphone. I am facing issue with the microphone data, and have ...
42
votes
9answers
6k views

Using volatile in embedded C development

I have been reading some articles and Stack Exchange answers about using the volatile keyword to prevent the compiler from applying any optimizations on objects ...
1
vote
2answers
156 views

Finding the address of structure knowing the address of one of it's members in C

This sounds like a little too far fetched, but is there any possibility to find the address of a structure, if the address of one of it's members is known? The struct itself contains different data ...
0
votes
1answer
92 views

how a number is stored in processor [closed]

Background: I am sampling a signal from accelerometer at a rate of 20KHz( period of every 50 micro seconds). I need to store this information in memory card. Kit: STM32F40, IDE: Keil. ...
1
vote
1answer
62 views

ATmega328p PIN reading

...
-1
votes
0answers
30 views

Block reading of SDHC returns 0x00

I have a 4 GB sd card attached via SPI to my XMega MCU and I want to read this card with the USART-SPI interface in SPI mode of the MCU. So i have this code SD.c ...
0
votes
1answer
65 views

I2C driver for MSP432

I am trying to develop a I2C driver for MSP432. As of now, I am interfacing a accelerometer through USCI B2_ module on MSP432. The problem that I am facing is I am getting a NACK in the IFG register ...
-2
votes
1answer
69 views

128x64 Graphic LCD(TG12864B V1.1) monitoring problem (driving from STM32) [closed]

I'm try to write a driver for driving 128x64 GLCD. But whatever I did, it doesn't work. I put the code below. What is wrong?. edit I can write some character but Random pixels appeared on the LCD....
0
votes
1answer
179 views

C Language Pointers Question [closed]

Not sure if this is the correct place to post a programming based question so will have a go anyway. Attached below is a piece of code and a table where I have to fill in the blanks. Just to clarify, ...
1
vote
2answers
131 views

How to design Watchdog timer that reset the system if Watchdog counter is not cleared at least every 1/4 seconds

This is the code I have for a green LED blinking every 2s with watchdog mode for MSP432. ...
0
votes
1answer
62 views

Newbie question: C programing for AVR

The following lines which works exactly opposite to what i'm expecting, would appreciate correcting my understaing: Button connected with Pin D2 & Led B2: ...
0
votes
1answer
55 views

LIS2DH12 Watermark and Overflow Interrupts at the same time

I'm working on a project that uses the LIS2DH12 accelerometer by ST (product page). I have a couple of questions about it, and as it is quite a common part, I wonder if anyone here knows the answers: ...
0
votes
1answer
48 views

Where MOSI is triggered low or high

Sending and Receiving Data //Function to send and receive data for both master and slave ...
1
vote
2answers
96 views

Compile time calculations in C

I have been implementing a control software in C programming language. One of the software modules represents a communication table for some proprietary communication protocol. Each record in this ...
2
votes
4answers
273 views

STM32 MCU - Temp sensor gives weird values

I'm fooling around with a Nucleo-F103RB STM32 board and I'm trying to measure the ambient temperature using its internal sensor. I activate the ADC and get data normally via the ...
0
votes
3answers
170 views

Accessing and storing a bit from a uint8

I need to access a particular bit from a uint8 variable, and store this bit value to another uint8 variable. Right now I am ...
1
vote
0answers
76 views

strange array values (C, psoc, usbuart)

I am still fairly new to programming, so I'm sorry in advance if my terminology/formatting isn't up to scratch. I am currently working on an element of a musical instrument that will allow me to ...
1
vote
0answers
32 views

Problem with SPI communication with MAX31855K from STM8S103F3

I am trying to read temperature data from MAX31855K over SPI, using STM8S103F3 on a breakout board. Development set up is STVD, STVP and Consmic compiler. And using STM8S Standard Peripheral library. ...
0
votes
2answers
91 views

STM32 USART Receive Binary Number

I'm new to embedded systems so apologies if this is a stupid question. I am trying to implement a binary counter in the form of 8 LEDs. I want to send an 8-bit binary number through USART and have ...
0
votes
2answers
61 views

Not getting acknowledgement from MPU 9250 I2C slave using STM32F401RE

I am using an STM32F401RE development board to communicate over I2C to an MPU9250 based breakout board sensor. So far I have set the start condition, and sent the slave address/write bit to the device,...
0
votes
2answers
110 views

Array to control individual GPIO's [closed]

I'm new to embedded systems and C programming. I am Currently trying to program a PCB using an STM32 microcontroller to control an array of 8 fans upon receipt of a single command. i.e 00001011 will ...
1
vote
0answers
69 views

Controlling DAC161S997 via SPI

I am using msp-exp432p4111 devalopment board and trying to use DAC161S997 with it.The main goal is creating a ...
1
vote
0answers
136 views

Why more codes do not work with PIC microcontroller when RAM and ROM have free spaces

I code for reading EEPROM and edit those EEPROM data and work with those data. Normally I am coding something and upload to PIC and check that code. When I am code more than some point it is not ...
0
votes
2answers
82 views

LED Blink is not working but code can program with PIC18F4550 and MikroC

I tried to code LED on-off program for test PIC18F4550 microcontroller. The code can program to IC using Pikkit 2 but a program is not working. I code by using MikroC Pro for Pic 6.6.1. I am using ...
3
votes
1answer
142 views

Coding style in STM32 HAL code

While I was reading the STM32 HAL drivers for timers I found this macro: ...
1
vote
1answer
94 views

Purpose of 2nd order filter for processing temperature measurement

Please forgive me if this is a very basic or silly question but I would appreciate some help. I'm working on someone else's code and have come across a few lines that have been described as a 2nd ...
0
votes
1answer
50 views

PIC32 hashtag usage in token pasting

Library pps.h of PIC32 contains a pre-processor function that directs a peripheral's input/output to certain micro-controller pins. The function is: ...
0
votes
0answers
34 views

Byte Size Data to Word Size Data in MikroC with PIC microcontroller

I tried to store some EEPROM data to variables. Those are bytes size variables. Now I want to convert that code to Word variable because I want to use more than 255 values. My byte size variable ...
2
votes
4answers
134 views

Is there a way to write a generic GPIO code for MSP430?

I'm currently working on an MSP430 board and I'm trying to create libraries for it so I can easily use them on my project. I'm starting with basic Digital I/O functions. Say for example I need to ...
7
votes
7answers
2k views

Is it possible to interrupt the copy process of a struct by an interrupt in embedded C?

Inside the driver I have got a function to copy the data from the internal struct into a struct from the application. Can this process be interrupted by a microcontroller interrupt trigger? ...
-3
votes
1answer
74 views

Applications of Conio.h in embedded C [closed]

I have used conio.h library file in C and CPP for functions like clrscr() and getch(). What else is it used for in embedded C ? Conio.h functions clrscr delline getch getche gotoxy kbhit wherex ...
-1
votes
2answers
104 views

when dividing two integer result truncated to 0 [closed]

when i divide two integer and if the result is below like 0.987, then it become zero ...
3
votes
3answers
194 views

C to C++ How do I make h/w initialization look neat? [closed]

Doing an experimental conversion of some firmware from C to C++ to try and get a better structure in it, since the C code "evolved" in line with experiments across a 2 year period. The question is ...
0
votes
0answers
139 views

STM32 issues getting the ADC to work

I am having some trouble while trying to get the ADC on a custom PCB with a STM32F042 to work. I am using CubeMX to generate all drivers/HAL/... and SW4STM32 to write and debug my code. I am setting ...
5
votes
2answers
378 views

STM32F0 - run user program from SPI flash memory

I'm building an application based on the STM32F030F4P6 microcontroller. During the development of the firmware, I realized that the flash memory of the microcontroller is too small. Can I run my ...
0
votes
1answer
42 views

relay control with network and sms with main controller [closed]

I need this project for a melting plant. There must be two relays in the control (connected to the device), so if one of them is in trouble, another will work to disconnect. In the (current check) ...
16
votes
5answers
2k views

Possibilities for allocating memory for modular firmware design in C

modular approaches are pretty handy in general (portable and clean), so I try to program modules as independent of any other modules as possible. Most of my approaches are based on a struct that ...