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
2answers
39 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
44 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
44 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
43 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
33 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
0answers
15 views

How to prevent Ardiuno compiler from merging changing of port pin outputs into a single operation [migrated]

I want to set one pin's output value, and then set a different pin's output value so that the two pins change value one after the other. However, the compiler optimises the two calls to change both ...
0
votes
1answer
25 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 ...
0
votes
0answers
29 views

Read multiple channels of adc & display on 7 segment

I am building a voltmeter which can read voltage from multiple adc channel & display the channel number and voltage on a multiplexed seven segment display .I am currently able to read from a ...
2
votes
1answer
82 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
430 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 ...
2
votes
2answers
116 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
22 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
79 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
222 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
214 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
104 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
101 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
66 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 ...
0
votes
1answer
49 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
85 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
70 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
81 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
18 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
48 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
77 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
98 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 ...
1
vote
2answers
212 views

Why using a pointer interfacing LCD HD44780

I'm trying to interface with an LCD display (HD44780). I came across a tutorial on the internet to send characters and strings to the display. Everything went well and it works fine but I have no idea ...
0
votes
2answers
67 views

Choice of the appopriate conditional statement

I'm measuring the width of a PWM puls with the external interrupt: ...
1
vote
0answers
57 views

BH1750FVI with I2C won't work

I have the led driver of Adafruit connected to my atmega32. I adjusted their library for the Arduino, so now I just need a µcontroller and not an Arduino. This thing works. Now I want to control the ...
0
votes
1answer
59 views

MPLAB X IDE on computer emulation / debugging how to set input values?

Is there any way I could emulate input into chip using the free emulator, when debugging my code to see if it responds correctly into input?
0
votes
3answers
105 views

Is it Electrically Correct to Direct Driving Seven Segment in Multiplexed Manner?

I want to design a voltmeter with minimum no of components so the pcb becomes as small as possible.For this purpose i wish to direct drive the seven segment display. Considering the fact Typically ...
0
votes
1answer
71 views

Different data type volatile unsigned int to const char ,

I have to reply via SMS the value of a variable if the password is sent to arduino by help of sim900. I am able to switch an led on successfully. Now I want the arduino to reply to me the variable ...
0
votes
1answer
62 views

How to display character on multiplexed seven segment?

I am designing a system which I want to display a message on a seven segment display. I have the source code for displaying a number but how to display a character ?? ...
0
votes
1answer
105 views

PIC - 4-20mA (Duty cycle formula)

I am implementing a 4-20mA current loop to my PIC. I have everything working. I am measuring the distance away from an object. When I hardcoded the distance as 300 the output voltage is 4V and when ...
1
vote
1answer
83 views

External interrupt doesn't set flag bit

My goal is to measure PWM pulses. But to achive that I'm making baby steps, so my first goal is to set a pin when an edge of the PWM signal is detected. The PWM signal enters the microcontroller ...
1
vote
1answer
64 views

Compilers for STM32F303x [closed]

Does anyone have any suggestions for C/C++ compiler/debugger for this chip, initially via ST-LINK on a Discovery board? I am currently using IAR EWARM but am not particularly happy with it.
2
votes
2answers
335 views

Best method to transfer two int percentage values over a CAN bus

I have two integers: int A is a value from -100 until 0 and int B is a value from 0 to 100 What is the most effective way to put this into a CAN message and decode it again at the other ...
0
votes
1answer
90 views

libmodbus trouble with reading from slave

I have the following code for connection to a temperature sensor as my slave using the libmodbus library in C, ...
0
votes
2answers
94 views

Blinking LEDs in reverse order

The code below flashes some LEDs in order: pin 1, pin 2, pin 3, pin 4. After this sequence has completed I would like to reverse direction and show pin 4, pin 3, pin 2, pin 1. I wrote the code ...
0
votes
2answers
36 views

Need help with pushbutton on atmega8

This is what I have: Atmega 8 wired for programming, confirmed working, programmer is my power supply. 2 leds connected via 470Ohm pull up reisistors to ports PORTB0, PORTB1 and to GROUND, working. ...
0
votes
1answer
81 views

ATmega8 LED blinking project not working properly

I am making a simple project using ATmega8 microchip. I uploaded this code to the AVR: ...
0
votes
0answers
107 views

Regarding configuration of 50kg load sensors with Arduino due and 8-pin LM741CN Op-Amp

Please don't mind if my question is naive. I am new to this thing but I am pretty much interested in playing with these sensors. I am trying to configure the 3 wire load cell/strain guage (50 kg ...
1
vote
2answers
63 views

Set function to specific address in PIC18F with the HI-TECH C compiler

I want to put a function in an specific address of memory like PIC C Compiler (#org). I'm using MPLAB X, HI-TECH compiler and PIC18F4550. In PIC C compiler: ...
0
votes
1answer
77 views

AVR TIMER0 treating with prescaler and without to blink a led

I am playing with ATMEGA168A's TIMER0. CPU is running at 20MHz and there are two treatments. a) Blink a LED at 20ms frequency by using a 1024 prescaler. In that case i count the the times that an ...
1
vote
2answers
135 views

ATMEGA328p ADC keeps returning 1023

I'm trying to configure my ATMEGA328p to measure temperature using the TMP36GZ temperature sensor. However, the 10-bit ADC keeps returning 1023. I've tried disconnecting the temperature sensor (it ...
3
votes
1answer
94 views

Problem in writing register maps using C structure for a TI Microcontroller

I am writing register maps in C for a TI ARM based Micro-controller board. Here is the link to the datasheet. I am using the following guidelines on how Register maps should be written in C: ...
0
votes
1answer
67 views

Can some pins of the same port on AVR MCU's be declared as inputs and some as outputs?

Can some pins of the same port of AVR MCU's be declared as inputs and some as outputs? If yes, then I am not able to understand how this works since we have to compare the pins of the port and also ...
0
votes
0answers
47 views

C Coding Examples For Mc9S08Se8 Microcontroller

Can any one provide me an example c coding for producing a single PWM output and toggling a port pin from MC9S08SE8 microcontroller. I browsed many sites but I find no example c coding for this ...