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
0
votes
1answer
53 views

How to replicate/simulate experiments done on dsp kit 6713 without using hardware? [closed]

Although i posted this question on DSP SE yesterday but still couldn't find any helpful reply there so i am reposting my question here Due to covid, our university is now offering online classes to ...
1
vote
1answer
51 views

MSP430 Prevent Bouncing

I'm currently working on a homework that does: the first press to the button at P1.1 opens the LED at P1.0, the second press to the same button blinks the LED and the third press closes the LED. I ...
1
vote
1answer
92 views

RS-485 module not transmitting LF and CR

I am working on a project that involves two ATMEGA328p MCUs communicating over long distance (between two floors of a building). One is master and the other one is slave. The master always initiates ...
0
votes
1answer
73 views

HCSR04 with PIC18f24k22 stuck in real test

I have a problem with HCSR04 ultrasonic distance sensor. I wrote a code that works perfectly in Proteus simulator but when I upload it in real microchip it stop working properly. Looks like it sticks ...
-4
votes
1answer
85 views

Making a simple calculator with ATMEGA32

I try to create a calculator with ATMEGA32 but it did not work correctly! For example it do operations like this (2/1=0),(5*6=12808),(22+88=12746). I know that something is wrong but I cannot find it ...
-1
votes
1answer
68 views

Assign a pointer element of structure to an array [closed]

typedef struct { int a; int* b; } foo_t; int main (void){ foo_t foo; int array[10]; foo.b= &array[0]; } Here is a sample code. As you ...
0
votes
0answers
38 views

SPI communication between FPGA(ZC-706) and Amega128

I'm trying to write a communication protocol between an FPGA and a Microcontroller through an SPI, the µC being the Master here. FPGA: ZC-706 (Zynq-7000) µC: ATmega128 Here is the code which i used ...
0
votes
3answers
68 views

How to make sure my motor will not start spinning on power up in case the throttle (POT) was not at a 0 position?

I am trying to make sure my motor which is connected to my controller circuit would not just start spinning when you first apply power to it as if the Potentiometer is left high before the battery is ...
0
votes
2answers
81 views

PIC18F4550 : How to convert 16 bits integer to two 8 bits chars in C?

I'm blocked because of an issue that is causing a lot of time loss. I've created a function to get the LSB and another one to get the MSB. ...
0
votes
1answer
32 views

Timer1 not counting T13CKI pulses on PIC18F4550

I have a big issue on Timer1 of a PIC18F4550. Actually I have connected a 4060 IC which provide a square signal of 4Hz on RC0 input of the micro-controller (please refer to attached image). After ...
0
votes
1answer
47 views

STM32G474 not erasing flash by page?

I am writing to the flash memory of an STM32G474RE using the HAL libraries. Here is the section of code I've been using: ...
0
votes
2answers
82 views

Raspberry Pico and DHT11 not working C/C++

This is my Wiring here + is connected to 3v3, - to GND and OUT to pin28 I'm using this ...
0
votes
0answers
31 views

How to use the full 10-bit PWM resolution (PIC18F2xk22)?

Hi I am trying to use the full 10-bit PWM resolution for my project, and there is a problem as the duty cycle of the PWM will not set to zero when I rotate the POT to the zero position, here is my ...
0
votes
2answers
93 views

Reading Multiple ADC channels with a PIC18F24K22

I am having issues with reading 2 ADC channels in my code running in a PIC18F24K22. One channel is used to read a potentiometer to control the speed of a motor ( PWM) and the other is reading a ...
0
votes
0answers
97 views

STM32L476RG ADC bare metal

I bought STM32L476RG nucleo to learn bare metal programming. Im following a online course on udemy and so far i have suceeded with everything except hitting a wall now with ADC. First of all i have ...
1
vote
5answers
220 views

Problem with IC chips, Eprom and LCD Screen

EDIT: I have made the changes suggested with the &gate and the 555 timer to get the (E) enable pulse. I hooked up a debounced switch so I could walk through step by step. This highlighted some ...
3
votes
2answers
245 views

Synchronization mechanism suitable for bare metal applications

I have been developing a bare metal control application on dsPIC33EP256MC506. My application consists of infinite loop in the background and three foreground "application" interrupt service ...
0
votes
1answer
42 views

RPi-PIC18 I2C: problem with first byte

I am having a bit of a problem with RPi-PIC18 I2C communication. The raspberry is the master, the problem is with the PIC18F25K80 slave device. Here is my code regarding the I2C parts: ...
0
votes
7answers
243 views

Is it possible to remove a line of code from microcontroller program memory?

int main(void) { while (1) { delay(50); if (ButtonPress1) { ResetOutSwitch(); } } Suppose that button press is detected and output switch is ...
4
votes
6answers
2k views

Order of operations and rounding for microcontrollers

I was working on a project where I read a value from a 16-bit ADC and scaled it to obtain the reading of a sensor. For example: ...
1
vote
2answers
113 views

Incremental encoder - polling or interrupts?

I took over a project including PIC18f25k80 microcontrollers and incremental encoders. Basically I just need to follow the position of the motor using the encoder, and drive a device to specific ...
0
votes
1answer
58 views

Find the size of a certain code block

I have an application with a BLE stack and I'd like to figure out how much space that stack uses up (more or less) in order to figure out if I have enough flash available to write an additional BLE ...
0
votes
0answers
49 views

How to read BMP280 “chip_id” using the Tiva TM4C123G SPI communication interface?

Am trying to read the chip_id of the BMP280 Pressure/Tempeture sensor using the Tiva TM4C123G Launchpad thought the SPI communication protocol. To begin with let me provide some back ground info and ...
1
vote
2answers
67 views

Modifying an irregular length bit field in a register in C/C++

Suppose I wanted to modify the field ADD[7:0] in the following register: I wrote this to make things more convenient. ...
0
votes
2answers
77 views

CANBUS Masking and Filtering

I am using a module to convert CAN to UART. This module has 2 programmable masks and 6 programmable filters. There are 13 message IDs that come in over the CAN bus and I only want 9 of them. The IDs ...
1
vote
3answers
163 views

Send Data With Usart STM32

I have to send data using the usart2 in my nucleo64 stm32f446re board. The type of data I have to send is float but until now I always send uint8_t using this code; ...
0
votes
3answers
86 views

How To Save A Matrix In Flash Memory In STM32

i'm new in stm32 and in embedded world in general. I'm using a nucleo64 f446re and I want to save a matrix in the flash memory. Can I use CONST to do this?
0
votes
1answer
30 views

UART doesn't transmit all characters when using UDREn interrupt

Note: I am beginner :) MCU: Atemega328p In Method 1, I am using a UDRn data register empty interrupt once the transmit buffer is empty and inputting characters from ...
1
vote
2answers
63 views

Does this interrupt improve performance even with while loop in ISR?

Note: I am a beginner :) MCU: Atmega328p Which program below burdens the CPU the least? Would it be a significant difference? Objective: to make a more "efficient" serial monitor by ...
0
votes
2answers
62 views

Checking and reading bits using while loops

Note: I am a beginner :) MCU: Atmega328p I am struggling to understand how reading registers using while loops work in Embed C: For example AVR-C USART Protocol: ...
1
vote
2answers
108 views

Why would you right shift 8 bits for 8 bit register?

MCU: Atemega328P Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf (Page 143 - USART) Note: I am beginner :) Using the BAUD ...
0
votes
0answers
42 views

Old VFD clocks and wired button problem

So, my friend stumbled across this old article: https://steemit.com/electronics/@gleb-jeglov/how-to-make-a-vfd-clock-step-by-step He gave me couple IV-18 tubes and asked me if I can make similar ...
1
vote
2answers
84 views

Tact switches only work once

I am trying to do a digital clock using an Atmega8A, LCD display (2x16) and four tact switches. Key number 1 is connected to pin PD2, number 2 to PD3, number 3 to PB6, number 4 to PB7. When you press ...
0
votes
2answers
65 views

How do I get started in C using avr-gcc on the mega2560 [closed]

I've program the arduino using tools before (on windows) and using C++ but never with c++ without tools nor done it on linux I have a (at)mega2560 and want to do a simple blink program like the below <...
0
votes
0answers
47 views

Normal Mode of CAN Controller in STM32L476 Nucleo Board is Not Working

I am using STM32L476RG Nucleo board which contains only one CAN controller(bx_CAN1) and SN65HVD233 as a CAN Transceiver. I could able to test the CAN controller by using "LOOPBACK Mode". ...
1
vote
0answers
20 views

Lines transferred from main memory to Cache

I'm studying Cache memories and I would like to know exactly how the lines are transferred from memory to cache. Supposing I have a 32-bit machine with a 16kB directly mapped cache and 8 words per ...
0
votes
0answers
50 views

Snubber circuit for TRIAC

I have built TRIAC circuit below which I got off the internet. Without the snubber circuit works good, but with snubber the TRIAC is always on. I'm using 9v ac just for testing purposes. Can someone ...
1
vote
1answer
45 views

Pin change interrupt won't toggle OFF my LED

Friendly Note: I am a beginner :) Microcontroller: Atmega328p LED = PORTB0 BUTTON = PORTB1 Aim: To have the button generate a pin change interrupt request which runs an ISR that toggles PORTB0 ...
0
votes
0answers
69 views

STM32F103C8 I2C BUSY flag reset

I'm using HAL to use I2C and somemtimes I'm getting HAL_BUSY flag, I read STM32F103 errata and added BUSY flag clear according this, i2c busy flag clear But I changed error handling little bit and is ...
-2
votes
1answer
47 views

Cross talk issue ADC PIC18F2458 [duplicate]

I have used the following configuration according the data sheet FOSC/32, 12 TAD I still get cross talk, I'm using 3 ADC Channels with USB, and When I use one Channel, other channels get affected I ...
0
votes
0answers
83 views

Writing USB Joystick for PIC18F using MikroC

I'm using PIC18F2458 as USB Joystick HID. The program works, but I have few problems. Right now, The USB is not detected If I write less than 5 values ( Throttle, X,Y, 4 buttons). The current problem ...
0
votes
1answer
53 views

STM32L053R8 - Bare metal LED issues

I'm following a bare metal course, I have managed to set up the project within IAR, my project compiles and runs. I'm attempting to get the user LED (LD2) to flash before I continue the course. I'm ...
0
votes
1answer
143 views

How to share a variable between ISR and main-code?

I'm working on some embedded software and I ran into a problem and I cannot figure out why this block isn't working. I set up interrupts to for several buttons, including a mechanical encoder. I used ...
1
vote
1answer
68 views

Execution of a piece of code in embedded

Can anyone explain to me step by step What is the result of executing the code below: DDRB = 0; unsigned char temp; temp = (PINB & (1 << 4)) >> 4;
-1
votes
1answer
86 views

Can I assume a compiler for a 32 bit microcontroller supports C99 variable-length arrays?

I'm making a C library for the embedded system community. I was wondering: In your experiences, do most people use compilers that support C99 VLA?
1
vote
0answers
139 views

How do I know if my I2C interface is working properly?

I have an MSP430FR6989 (MSP-EXP430FR6989 launchpad) interfacing with a MAX30102 Pulse Oximeter and Heart Rate sensor IC via I2C, I have only one master and one slave. According to the pseudo-code in ...
1
vote
1answer
84 views

Connect HC-05 and esp8266 with MQTT protocol

I trying to use Bluetooth HC-05 with esp8266 to connect with Mqtt broker (Raspberry Pi), I already know how to connect by Wi-Fi, because there are a lot of example code for it. But not for Bluetooth. ...
-3
votes
1answer
31 views

How can i find the AT24C256 reg_addr?

For i2c to eeprom (at24c256) how can I find the device address and register address? ...
0
votes
1answer
70 views

Using C++17 static inline members in embedded MSP432 application, program fails to launch as reset occurs

I am unable to debug my embedded software since I started using static objects. I do not think that there is much difference in memory allocation/initialization between the classic static variables ...
0
votes
1answer
47 views

Two stepper motors at different speeds using potentiometer and Ardunio

I am trying to control two different motors using Arduino and some drivers. The problem I have is that using mills() (i need to use timer with out delay due to me wanting more than one motor at the ...

1
2 3 4 5
29