Questions tagged [atmega]

ATmega is a product line within Atmel's AVR micro-controller family.

The official website can be found here.

819 questions
6
votes
3 answers

How to detect how long a button was pressed in Arduino?

How can I detect how long a button was pressed / released in Arduino and then print some custom output after that?
Rafael Beckel
  • 2,199
  • 5
  • 25
  • 36
6
votes
1 answer

Cannot compile and link AVR program in OS X

I am working on a Mac with Yosemite OS X and I'm trying to compile a program in C that I could then upload onto my Arduino. I am following a tutorial. I tried going through and reinstalling avr-gcc, but I got the same output. I tried searching for…
6
votes
6 answers

Advantages of atmega32

What are the advantages of using ATmega32 than other microcontrollers? Is it better than PIC, ARM, and 8051?
Komal
  • 85
  • 1
  • 2
  • 7
6
votes
5 answers

How to reverse a byte

I am currectly working on a project and it happens that I have to reverse the order of a byte. I am currently using AVR Studio Mega32 Microcontroller. For example: 0000 0001 becomes 1000 0000 0001 0110 becomes 0110 1000 1101 1001 becomes 1001…
stefana
  • 2,606
  • 3
  • 29
  • 47
5
votes
2 answers

ADC only working once on ATMEGA324PA

I have some code which should read the values of a couple of ADC pins, each time around the commutator loop. static uint16_t adc0; static uint16_t adc1; void init(void) { ... hw_configure_adcs(); ... } void loop(void) { ... …
fadedbee
  • 42,671
  • 44
  • 178
  • 308
5
votes
5 answers

Using a rotary encoder with AVR Micro controller

I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168. Clarification I have tried using an External Interrupt to listen to the pins, but it seems…
Marius
  • 57,995
  • 32
  • 132
  • 151
5
votes
1 answer

USART wrong data incoming

I am writing a communication between Atmega162 and PC. On my PCB I have interface RS485 (converted from RS422 by MAX485) and it goes through ADAM-4520 transceiver into COM port. I've been testing my program in terminal and it seems strange to me,…
pasiasty
  • 71
  • 8
5
votes
2 answers

AVR programming, interrupt handling

I develop a C application with atmega168a-pu and interrupts. I use the following interrupts: ISR(TIMER0_COMPA_vect); ISR(TIMER0_COMPB_vect); ISR (TIMER2_COMPA_vect); ISR(SPI_STC_vect); ISR(TIMER1_COMPA_vect); ISR (PCINT1_vect); and my code looks…
Johan Elmander
  • 497
  • 2
  • 6
  • 11
5
votes
3 answers

Sending float type data from Arduino to Python

I need to send float data to Arduino from Python and get the same value back. I thought to send some float data from the Arduino first. The data is sent as 4 successive bytes. I'm trying to figure out how to collect these successive bytes and…
tez
  • 4,990
  • 12
  • 47
  • 67
4
votes
3 answers

Unexpected float behaviour in C with AVR atmega8

I've been trying to figure out why I cannot get a sensible value from multiplying an unsigned int with a float value. Doing something like 65535*0.1 works as expected but multiplying a float with a uint from memory creates mad values. I have a…
regomodo
  • 644
  • 3
  • 9
  • 18
4
votes
1 answer

Why a*b/c instead of a*(b/c) gives 3x bigger program size on AVR?

Recently I tried to pack my code into small ATTiny13 with 1kB of flash. In optimalisation process I discovered something weird for me. Let's take the example code: #include int main() { TCNT0 = TCNT0 * F_CPU / 58000; } It has…
aso
  • 1,331
  • 4
  • 14
  • 29
4
votes
3 answers

AVR - Interrupt Vector and Global Variable

I am using an ATmega32 to interrupt every 32ms to do some arbitrary stuff, which isn't really important for now. I'm using the timer overflow of timer0 to interrupt, which works predictably and perfectly. My problem is I have a global…
Ospho
  • 2,756
  • 5
  • 26
  • 39
4
votes
2 answers

Bluetooth control signals (DTR, DSR, RTS, CTS) on Android

I would like to remotely reprogram my Arduino via Android over Bluetooth SPP. The first step is to reset the ATMEGA microcontroller. This is accomplished on the Arduino by toggling the DTR line. Is there any API to control the Bluetooth SPP control…
4
votes
2 answers

ATMEGA168A - F_CPU warning

I have written the code below in order to make an ATMEGA168A blink a small led: #include #include #define F_CPU 1000000UL int main(void) { DDRB = 0b00000010; PORTB = 0b00000000; while(1) { PORTB…
Kaguei Nakueka
  • 993
  • 2
  • 13
  • 34
4
votes
2 answers

Arduino Programming Without Arduino Libraries - Atmel Studio

I would think this question has been asked thousands of times, I simply cannot find many resources on the subject. I would like to program my Arduino Uno (ATmega328P) using Atmel Studio and the C language, minus the Arduino Libraries. What I mean by…
Joshua Granger
  • 152
  • 1
  • 2
  • 10
1
2
3
54 55