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 ...

learn more… | top users | synonyms

0
votes
1answer
30 views

need help making a c program that reads flow meter

For the past week, i've just started my first ever project to make a C program for a PIC16F877A under MikroC, where I would get pulses in from the flow meter and calculate the flow rate, then output ...
0
votes
1answer
54 views

Help understand a simple C code for an atmega16 project [on hold]

I just got started with AVR , and I am building a Lan tester for a project My hardware part is done, basically for the send pins I used port A , from A0 to A7 and for the Receiver port C when the ...
0
votes
0answers
33 views

CAN bus on STM32F429 receiving messages

I am using the STM32F429 HAL CUBE for a CAN bus implementaion. I am able to transmit some CAN bus messages, but my receive function is not working. Is it compulsory for receiving messages to write a ...
7
votes
4answers
2k views

Why GCC compiler omitting some code?

I can not understand why GCC compiler cutting out part of my code while it preserve absolutely the same one in the neighborhood? The C code: ...
0
votes
1answer
63 views

Arduino ECG sputtering out totally random values

Hello StackExchange community, I have encountered a problem in my ECG/EKG design. I am trying to create the ECG using Arduino as a microcontroller to send/retrieve heart rate measurements via ...
-4
votes
1answer
41 views
0
votes
0answers
17 views

DS2401 initialization and usage

I have never worked with OneWire before and I am now trying to make the DS2401 Serial Number work, but without luck. Of course I started by reading the datasheets for the Serial, but I did not really ...
0
votes
3answers
69 views

LCD not working!

I am using a PCI1602F-B from Powertip as an LCD and an ATmega8 to communicate with it. Connection: -PORT D of ATmega8 with data-bus of LCD -PORT B0 of ATmega8 with Rs pin -PORT B1 of ATmega8 ...
2
votes
1answer
53 views

Is printf debugging over USB with STM32 possible?

I've been doing a lot of searching to try find some examples for printf debugging over USB for the STM32 (specifically stm32f1x). I have found a few examples for UART/USART however I can't find any ...
2
votes
0answers
47 views

How can I log information from code in IAR Embedded Workbench to a log file?

I'm trying to develop an application for the NXP LPC1788 microcontroller and I would like to be able to log formatted strings at arbitrary points within the source code to a log file in a way that has ...
1
vote
0answers
52 views

CRC32 on SAM D20 (Cortex M0+)

I've been having a hard time debugging the DSU module on a SAM D20 (datasheet). I mean to utilize it to calculate CRC32 for a program I'm uploading through a custom bootloader (bootloader not mine). ...
1
vote
1answer
53 views

'undefined reference to' errors trying to compile with Make

I had a working Makefile that successfully compiled and built a basic program to toggle and LED on my stm32-h103 board. I have since attempted to add and use FreeRTOS in my program. I have added in ...
-1
votes
1answer
72 views

Embedded systems programming in C [closed]

I want to start programming embedded systems with C (need it for school anyway and I like C). I searched for beginner guides and such quite a long time before deciding to post here. I have several ...
2
votes
1answer
268 views

How a compiler generally works for a microcontroller

I want know how a compiler works. I know the stages of compilation, but How will the compiler allocate the segments (data, heap, and stack) for a microcontroller? How will it optimize the code? ...
1
vote
1answer
41 views

undefined reference to `ROM_SysTickIntRegister'

I am trying to program the Stellaris LaunchPad to blink the red LED at 1 Hz, driven by the sysTick interrupt. I get an error though that I've been unable to solve yet. The C source I came up with ...
2
votes
1answer
50 views

Why doesn't my LCD work?

I have an 2.8" LCD that it's controller is ILI9325. I'm trying to use it. for start off, I have written a simple program. the program is this: ...
2
votes
1answer
128 views

Arduino - Cannot get ECG readings from heart, but I do when I poke at the leads

I have a minor issue with my ECG. When I poke at the leads, I get a reading. But when I hold the leads or place it near my heart, I don't get anything. I'm pretty sure this is hardware related, but ...
0
votes
1answer
112 views

PIC UART CODE need help in debugging

My question has two parts: Does MPLABX have a UART simulator? I need help debugging this code: ...
1
vote
0answers
80 views

PHY device not responding to MDIO

Update: I have read more about this and what I can conclude is that the phy IC is not initialized correctly. Still no able to figure out how to initialize phy device. Please go through the code and ...
4
votes
1answer
174 views

PIC18F4550 External Oscillator

I am currently trying to get the configuration bits set up to blink a LED with a 20MHz external crystal. It is operating correctly using the internal oscillator, but does nothing with the crystal, and ...
1
vote
1answer
105 views

Reading infrared code XC8

SOLVED: I changed the infrared receiver and all went correctly, I am using the TSOP4838. EDIT:I have modified the code, I have been testing the program more deeply and I have found something weird. I ...
0
votes
2answers
69 views

how to write isr function

I used uart receive using polling method. But same I want to use in ISR. How can I write a ISR function. For example if I am using CC2541. In the manual I have seen that Vector Table for Port 1(where ...
14
votes
6answers
1k views

For embedded code, why should I use “uint_t” types instead of “unsigned int”?

I am writing an application in c for an STM32F105, using gcc. In the past (with simpler projects), I have always defined variables as char, ...
0
votes
2answers
78 views

Serial Servo Control using PIC

I am trying to make a serial servo controller using pic18f4550 microcontroller. following if the complete code that i've tried.. please note that i'm currently sending 8bit hex to control only one ...
1
vote
1answer
104 views

Uart serial communication failing to echo back Atmega16a

I am new to the avr (8bit uc) and recently I ran into a problem using serial communication (uart) with PC. Microcontroller fails to responsd in putty terminal where it should echo back whatever I ...
1
vote
0answers
60 views

Microchip 9808 temperature sensor - Incorrect calculation result

I am using a Microchip MCP9808 I2C temperature sensor (https://learn.adafruit.com/adafruit-mcp9808-precision-i2c-temperature-sensor-guide/overview). I'm having problems being able to calculate the ...
2
votes
1answer
81 views

Setting port in main loop causes ISR to starve

The example code initializes an asynchronous timer that is fired every second sets two ports as outputs (PA4, PA6 - LEDs connected) the timer ISR toggles pin PA4 permanently sets pin PA6 to 1 in the ...
1
vote
1answer
43 views

The program doesn't work correctly when I toggle the pin via Set and Reset register

I have two program to do the same task. the both should toggle GPIOB0. the first program is this: ...
0
votes
1answer
42 views

GLCD doesn't work

I have a ts12864a-2v2 LCD and I think its controller is KS0108B. I have downloaded this lib to use it for my LCD and also my MCU is STM32F103RET6. the schematic I have used to connect LCD to MCU is ...
2
votes
1answer
96 views

Documentation generator for embedded C projects

I'm looking for the equivalent of what Javadoc is to Java and from that, a way to standardize code documentation. Is doxygen more common in this context. Are there built-in, IDE-dependent options? ...
2
votes
1answer
448 views

Memory allocation in Microcontrollers

I know I'm asking a basic Question. But it will be very useful for me to continue my Micro-controller Experience. Consider I am using a controller with 256 KB Flash and 8 KB Ram. My Questions are I ...
1
vote
0answers
21 views

RC compare in capture mode - Timers SAM3X

So I am using an Atmel SAM3X8E micro together with a temperature sensor over a one-wire interface. The short version is: I give the chip a sequence of setup and start pulses, and the chip responds. ...
2
votes
2answers
145 views

Can someone explain to me programming logic behind multiplexing a LED segment display?

I am new to programming embedded systems, so any help is appreciated with my question. My task is to program (in C) a timer that counts up on a 7 segment common cathode display such that it will read ...
0
votes
1answer
31 views

display multiple data

I want to display 4 different data on a multiplexed seven segment display .I am able to display 2 data for a certain interval ,now i want to expand this to 4.How to do this . ...
3
votes
0answers
47 views

How to implement critical sections on ARM Cortex A9 for GCC, no OS? [duplicate]

I am porting some legacy code from an ARM926 core to CortexA9. This code is baremetal and does not include an OS or standard libraries, all custom. I am having a failure that appears to be related ...
4
votes
2answers
165 views

How to implement critical sections on ARM Cortex A9

I am porting some legacy code from an ARM926 core to CortexA9. This code is baremetal and does not include an OS or standard libraries, all custom. I am having a failure that appears to be related ...
2
votes
1answer
227 views

What is the maximum number of nested functions in PIC16F628A?

What is the maximum number of nested functions in PIC16F628A? ex. [NEW CODE, should be more explanatory] ...
2
votes
1answer
234 views

Can't modify global variables in interrupt, despite having declared them volatile

I can't seem to get my global variables (low, high) to change inside my interrupt, despite having declared them volatile. Below is my code. I find it strange that I can modify my global variable ...
1
vote
2answers
125 views

How to tristate output digital pin on a pic 16 series microcontroller?

I know that I can set digital output pins as high and low like this in c: OUTPUT_PIN = 1; OUTPUT_PIN = 0; Is there any way to set that said pin as tristate or ...
3
votes
3answers
106 views

Difference between __asm__ volatile(“jmp 0x0000”) and ((void(*)(void))0x0000)()?

Is there anything slightly different between the two calls? Which is the "better" version?
0
votes
1answer
74 views

Where to put Bootloader Key in Ram, what address is the last ram address?

I am programming a CDC Bootloader. What I want to do is to run the program, from there write a bootloader key to the ram at a specific address and watchdog reset the MCU. The Bootloader reads exactly ...
1
vote
1answer
62 views

PIC18 how to explain : you write bit 1 by making TRIS input

I'm reading 1_wire header file for PIC18 with C18 compiler. in the write_byte function, they specified that in order to write bit1; we make line input and that will take it high. can we specify high ...
0
votes
3answers
89 views

Pointer to an Memory Address of Flash Memory

I think that the following question is simple, but it is important for me to know. I am working on microcontrollers. I have seen some code to access the data from the flash memory. For example in ...
0
votes
1answer
93 views

CAN bus acknowledgment error

I am using an STM32F429 CAN bus program with TJA1041A as the CAN transceiver. The problem is that the messages are not getting acknowledged, and herewith I am attaching the code for further reference. ...
0
votes
2answers
106 views

How to send a buffer with spi

I use an atmega32 and I want to use the SPI bus. I have the Adafruit 24 channel, 12 bit pwm led driver. I use a buffer to set the pwm for a certain channel. The question is how to send the whole ...
0
votes
0answers
21 views

Reading Mac data of Zigbee protocol stack

I am working on a project using one of the popular Zigbee based RF-MCU Mac-codebases. I have integrated a sensor to the MCU and the same is reading data and I am sending data to the gateway using the ...
1
vote
2answers
54 views

Making a program that sends data to USB port [closed]

I want to create a program that is able to communicate to the USB port on my laptop. From this program I want to send data to the USB port constantly. Basically something like a hyperterminal, but ...
1
vote
0answers
85 views

Missing clock edges when using SPI on the CC430

I'm currently using the CC430F5137 and I'm having an issue with using SPI to communicate with an external flash. I'm currently using DMA to send out SPI comms using the UCSI_B module. Most of the ...
0
votes
1answer
217 views

MPU6050 I2C PIC18F458

I'm using MPU6050 with PIC18F45 protocol I2C. On EasyPIC v6 board its just send me back anything that I put in this WRITE command I2C1_Wr(0xD3);. I replaced the ...