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

-2
votes
2answers
25 views

From timer interrupt to the rerun of main function (PIC16f877)

I'm working on a basic project for a security system with PIC16f877 in MikroC, and I had a problem concerning the timer interrupt. I want the interruption to be cancelled when a chosen amount of time ...
0
votes
1answer
30 views

How can I set up SPI using Atmel Studio and C code for ARM processor?

I am trying to program the SAM3x8E chip on the Arduino Due through Atmel Studio. I would like to be able to control a digital resistor over the SPI interface with the SAM3 chip. I am running Atmel ...
0
votes
1answer
19 views

Check the value of FSL_M_Control in the MicroBlaze

I wrote a hardware accelerator which communicates with a MicroBlaze over FSL. In the Microblaze C code I would like to use putfsl() in a loop until the hardware ...
3
votes
1answer
509 views

Implement cryptography algorithms in an ARM microcontroller

Assume a situation in which you want do some encryption procedures in your ARM microcontroller. (Receive a file, encrypt with 3DES and some hash functions and returning it, for example.) As far as I ...
0
votes
0answers
11 views

switching between CCP capable ports

I am using PIC16f1788 it has 4 CCP ports two of them share the same CCP registers. I tried to switch between the ports using the following command : ...
2
votes
3answers
82 views

Interrupt question ARM?

I often see something like this void UART2_IRQHandler(void) __irq, and I wonder why __irq is used when declaring interrupt handler, is it required or handler can ...
0
votes
1answer
61 views

UART Interrupt won't work

I have a problem when trying to test send and receive lines on RS485 communication, anyone know what may cause a problem here? It works without interrupt but with interrupt won't work. I am working on ...
1
vote
3answers
77 views

Function to determine data size [closed]

I am using eeprom emulator which writes a page of flash of 60 bytes at once. Data to be written to that page is first stored in a 60 byte buffer (array of 60 elements) in ram and then transferred to ...
1
vote
2answers
34 views

getting the right frequency on XMEGA

I've wrote a small program that runs on an XMEGA : ...
0
votes
0answers
62 views

How to test RS485 communication via PC terminal?

I've tested RS232 communication via terminal with LPC1788 ARM CPU, and it works, now I want to test RS485. I just want to make simple echo program, what is sent, that is returned. Problem is that CTS ...
1
vote
1answer
31 views

ELF section flags not picking up flags from linker script

In my linker script for binaries on an MSP430, I have a memory section marked "rx": ...
0
votes
1answer
32 views

Stop timer set new value and start again AVR (Interrupt)

I have AVR MCU. I am playing with timer now. What I need ? I have timer counting up with some frequency. In each interrupt I am incrementing variable, and somewhere I need to check value of this ...
1
vote
3answers
254 views

Kp, Ki, Kd for software PID control

I am designing a software PID control. Logic is almost final but I wonder how do I decide the value of \$k_p\$, \$k_i\$ and \$k_d\$. Also, I need to determine the max and min value for the Pterm Item ...
1
vote
2answers
73 views

ADC value conversion

I am getting full scale ADC value from 0 to 16348. i am trying to convert it in 4-20ma and ...
0
votes
1answer
49 views

Measure frequency of a square wave using capture module

I wrote the following code to measure the frequency of a square wave using the capture module of the PIC16f1788. I wrote the code by following step by step what is required in the datasheet of this ...
0
votes
1answer
50 views

C Header with bits names for LPC1768

I'm starting with ARM and I program in C for LPC1768. I included "LPC17xx.h". It gives registers names in C. But where are the names of bits? For instance: I want to use UART. So first step: "In the ...
0
votes
1answer
55 views

Functions that return Enums?

In Atmel ASF I found this piece of code ...
0
votes
0answers
63 views

How to use printf(), scanf(), gets() etc with *both* USART's?

I'm using a PIC18F26K22. It has two USARTS. The compiler provides a printf() function, and the user provides the underlying getch() and putch() functions. However, using Microchip Code Configurator, ...
0
votes
1answer
46 views

Changing ADC clock speed does not change sampling speed [XMega]

I am trying to measure how fast my ADC samples arrive on an XMega128A4U. I have set up a timer and the ADC, and each time I have a result I let the DMA pull the CNT register from the timer and the ...
0
votes
1answer
40 views

Watchdog Reset VS Power Cycle

I am working on a system with a microcontroller than controls other microcontrollers, mainly sending commands to the other micros. I built in a Watchdog Overflow function on the 8051, which ...
1
vote
1answer
67 views

Floating Point problem using PIC18F4550

I'm making an obstacle avoiding robot and using the mentioned PIC controller. I'm currently not at the obstacle avoiding part so what i'm doing is writing code to control the movement, e.g. making it ...
2
votes
1answer
106 views

STM32: Timer interrupt works immediately

This is code for timer in my project on STM32F429: ...
0
votes
3answers
63 views

Delay function using timer/counter 1

i have made a function called _MY_Delay() which use 16bit timer/counter1 in ATMEGA16 , and used this function to blink a LED . the problem is i didn't work and i don't know the reason , here is my ...
1
vote
2answers
71 views

Ethernet Port Listener Throughput Maximisation

We have a distributed sensor network (12 nodes), using Ethernet as the backend protocol. These are networked at 100Mb/s to a single 1Gb/s link using a 16-port switch. I've previously seen Java and C ...
0
votes
1answer
65 views

Receiving a whole string from USART on ATMEGA16?

I am trying to receive a string from USART but failed , i want to receive char by char and store them in an array until the user enter '\n' and finally display the string to LCD , here is my code: ...
0
votes
0answers
49 views

Logic Analyzer doesnt work in Keil uVision 5 with STM32F4 discovery

Logic Analyzer doesnt work in Keil with STM32F4 discovery (STM32F407VG). I am using uVision 5. All my drivers are up to date. The code gets compiled without any errors, however, I cant get the Logic ...
1
vote
1answer
200 views

STM32F205VC: USART framing error?

I'm trying to use USART in my program on STM32F205VC, but instead of sending my data I get some weird chars in PuTTY. I've used a Saleae Logical Analyzer and the result looks like this: This is my ...
1
vote
2answers
127 views

ADC Read function not working properly

I am working on a school project where I need to read a bunch of analog values and convert them to digital with PIC16F1788(datasheet). I wrote the function using C and xc8 compiler. The problem is ...
0
votes
1answer
50 views

Using PSMC instead of CCP

Hi I am building a motor controller and I decided to use PSMC instead of CCP to create my PWM, my decision was based on the fact that I dont have enough CCP ports on my pic 16f1788 for the project. I ...
1
vote
1answer
70 views

Operating frequency of microcontroller PIC18f4550

I am new to PIC Programming, and thought of blinking LEDs as my first project. Now I copied a code from net which blinks two LEDs and its working, the LEDs are blinking. My settings:- I haven't ...
1
vote
1answer
40 views

port masking and ports in pic

i have data at portb on microprocessor (pic), i need to compress three bits rb3,rb4, and rb5, the other pins are various IO on port b, i wish to compress that info held in those three pins on port b, ...
2
votes
1answer
30 views

Clock switching hangs when switching back to original source

MIGRATED TO EE.SE http://electronics.stackexchange.com/q/159634/69868 I am currently working on a project where the clock needs switching between the Primary Oscillator with PLL (POSCPLL) to the FRC ...
0
votes
4answers
154 views

Use of free() in PIC Microcontroller Programming

In my Microcontroller PIC18f4550 code, I am using a function which returns an array, I know, C doesn't allow to return an array so I am just returning the address using pointers. Now after the address ...
0
votes
1answer
22 views

PIC18 EEPROM fails to write

I am working on a project using a PIC18F26K20. I need to store several value in EEPROM, but it does not store any data, all I evers get back is 0xff. Here is the code I am using: ...
1
vote
1answer
51 views

PIC18f4550 Timer setup for 1sec Interrupt

I want to generate Interrupt(on PIC18f4550 using TIMER0) every 1 sec but by using the following code interrupt is generated after every 6 secs. ...
1
vote
2answers
56 views

#pragma statements in PIC18F4550 C programming

I am new to Microcontroller programming and I thought maybe I should try blinking around 24 LEDs as a self project using PIC18F4550. I searched for a simple 1 LED blinking source code on net and what ...
3
votes
2answers
743 views

How to include math.h on a PIC?

I know <math.h> can be a large amount of code to include, but want to test out something using sinf() on a low-cost PIC. ...
0
votes
0answers
24 views

rx62N debugging error

I have created a simple code in HEW(HIgh performance embedded workshop ---- compiler provided by renesas) for rx62N microcontroller and used E1 emulator for the integration of board and my pc. Now ...
1
vote
3answers
141 views

How to split a floating point number into individual digits?

I am helping a friend with a small electronics project using a PIC microcontroller 16F877 (A) which I am programming with mikroC. I have run into a problem which is that I have a floating point ...
1
vote
1answer
96 views

PWM LED using TIM1 on STM32

I need to PWM my LED on STM32F3 Discovery which is on PE8. I have found code which is using PWM on PA8 and PC8 (one using TIM1) but unfortunately I can't change it to PE8. How to do it? Or maybe you ...
7
votes
4answers
1k views

My first STM32 code - please criticize me

I have just wrote my first code on STM32 - blinking LED. It combines a fragments from different sources; please criticize me so I can learn how to write proper code and don't learn stupid habits. ...
4
votes
3answers
103 views

interrupt using Timer0 on PIC18f

Im looking for a little help and advice on my code. Im using C18 in the MPLab environment, PIC18f4520 with Fosc @ 4MHz, and usnig timer0 in 16 bit mode to count to overflow, set the overflow bit and ...
1
vote
0answers
53 views

Strange behaviour using PWM on CortexM3

I have a board with the ATSAM3S2BA-AU, which is a Cortex M3 uC. I need to use 2 PWM channel , here how I've done it : ...
0
votes
0answers
31 views

Is source code compatible between DE2 and DE2-115?

I have 2 FPGAs: Altera DE2 and DE2-115. I was reading that source code is compatible between different computers and different cores. I have written a C program for use with the Micrium ucos rtos with ...
2
votes
1answer
75 views

Using different putch() function in a library

I'm writing a C library for PIC18 microcontrollers that will communicate with the ESP8266 chip over the UART bus. I would like to use the printf() function to send ...
5
votes
3answers
561 views

How to read whole data sent to USART with interrupt?

I am currently able to read byte by byte from USART with this code ...
1
vote
1answer
239 views

PIC12F683 or PIC16F688 assembly or C blinking LED example with XC8 compiler, MPASM or gputils

Hello I am new to PIC programming and I finally have got my dev environment working, I downloaded the XC8 compiler from microchip and also as backup I downloaded the gputils assembler. I have not been ...
0
votes
1answer
48 views

STM32F4 - counting DMA wraps

I am using DMA on an STM32F4 Discovery board to push values from an array into a peripheral. This needs to be done repeatedly, so I am using the circular DMA mode: ...
0
votes
0answers
54 views

Bootloader for AT32UC3C264C

Thank you in advance. I am trying to program a bootloader for my AT32UC3C264C chip. I want to update my firmware using bootloader. I haven't have experience with bootloader before but I did some ...
-1
votes
1answer
55 views

STM32F205 - can i use a timer to generate a low pulse of specified length

I want a pin to be high by default and then generate two 125-250 µs pulses with 0.1 µs resolution using a command. I was thinking about using TIM1 in one-pulse mode but I don't see a way to invert the ...