Questions tagged [avr]

AVR refers to two families of either 8- or 32-bit RISC microcontrollers

The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel in 1996. The AVR was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to One-Time Programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time.

External links:

2299 questions
0
votes
1 answer

Debugging AVR in Atmel Studio

I am learning to debug AVR in AtmelStudio. So I have written a simple program to test. But it compiles correctly but not executes as expected. I had written following code ATmega32 #include int main(void) { DDRA = 0xFF; PORTA =…
Ganesh S
  • 21
  • 1
  • 4
0
votes
1 answer

change PWM duty cycle from within ISR

I have little problems implementing a dither function to upgrade the PWM resolution of my ATmega88 and the leds it's controlling. My thought was, to use a "kind of" floating number, consisting of two uint8_t as "decimal places" so that e.g. "255.31"…
Sim Son
  • 310
  • 1
  • 10
0
votes
0 answers

Why interrupt from TWI can not fire

I am testing TWI module in AVR (Atmega328P). I have pulled up SCL and SDA lines. Why TWI interrupt service routine can not fire even once after switch (PB5) clicked? Please notice that I have this interrupt enabled, I have also TWI module enabled…
Adamos19
  • 49
  • 5
0
votes
1 answer

error in my AVR PWM library code

Hi I am creating a PWM library in c++ to use in my project. I have started working on it below is part of my code it is not complete yet. I have writing a bit by bit code and building it to find errors and I found some error so I stopped. Even…
Ganesh S
  • 21
  • 1
  • 4
0
votes
2 answers

Not able to read the pin value from Arduino Mega using PINxn

Using the register of an Arduino Mega 2560, I am trying to grab the information of the PORTA. I have referred to the datasheet (pages 69-72) and understood that I've to use PINxn (PINA) for this. But all I am getting is 0 as output. I have connected…
Nithin Varghese
  • 893
  • 1
  • 6
  • 28
0
votes
2 answers

My Quick ADC-Interrupt filling array - can it be any faster? (Assembly)

I made an Interruptroutine with asm that is already faster than a C-Version. Now i wonder if there could be a faster way for it (little tweaks). Any suggestions would be much appreciated. Times (Atmega328): My asm: 65 clocks Atmel Studio: 108…
Tobey66
  • 73
  • 9
0
votes
0 answers

To count number of pulses in avr between some elapsed time and display it

I want to count the number of pulses that occurred between a delay of 'n' seconds in atmega32 using 16bit timer and store and display it. ` TCNT1 = 0x0000; TCCR1A = 0X00; TCCR1B = 0X01; _delay_ms(150); TCCR1B = 0X00; int K = TCNT1; Is the above…
0
votes
1 answer

i want to transmit data from avr to pc.whats wrong in below connection or code

connection: USB to TTL interface modules four pins: 1)0v-volt of avr 2)vcc-5 volt avr 3)TXD-TX of avr 4)RXD-RX of avr and the USB to TTL serial interface module connected to PC using USB to RS-232 convertor DB9 cable. below is the code: …
0
votes
0 answers

I-bit in SREG not saved with IN-instruction

this already took me hours to figure out. With: in r18, SREG-0x20 the I-bit is not stored (0x94 in SREG translates to 0x14 in r18). The same outcome happens with this: ldi r30, lo8(0x5f) ldi r31, hi8(0x5f) ld r18, Z Maybe this is on purpose? Or…
Tobey66
  • 73
  • 9
0
votes
1 answer

Found something unclear in making codevisionavr code

I got a code example which says like this: DDRA = (1<
Anthony Lauly
  • 319
  • 2
  • 5
  • 17
0
votes
2 answers

atmega 328p interrupt and timer setup [C/C++]

I am trying to set up one interrupt and one counter/timer. The interrupt is external, reading low logic from pin. Timer should increment every 100 us and add up to count variable. I've set up the interrupt, which is working fine however, after…
flowian
  • 137
  • 12
0
votes
1 answer

ATMEGA8A + SPI memory strange behavior

I've bought SPI memory MX25L8006EPI and now I try to connect it to ATMEGA8A to test it. The schematic is very simple and doesn't change from others over the internet: ATMEGA8A works at 8Mz internal oscillator, 3.3V. The fuses are HIGH: 0xD1, LOW:…
folibis
  • 12,048
  • 6
  • 54
  • 97
0
votes
1 answer

Suspected error in textbook example - Atmel Assembly

So, I'm learning Atmel AVR assembly from Huang's textbook. There is the following example in the book: // Subtract 10 from mem(0x2000) ldi XL, 0x00 ; Load mem(0x2000) into X ldi XH, 0x20 ; ld r0, X ;…
Bassinator
  • 1,682
  • 3
  • 23
  • 50
0
votes
1 answer

ATMEGA 2560 uart code not giving out correct output on minicom

#include #include #define BAUDRATE 115200 #define BAUD_PRESCALLER (((F_CPU / (BAUDRATE * 16UL))) - 1) //Declaration of our functions void USART_init(void); unsigned char USART_receive(void); void USART_send( unsigned char…
enthusiasticgeek
  • 2,640
  • 46
  • 53
0
votes
2 answers

How to combine 4 bytes and do math calculation in C using AVR

I have an atMega1281 micro controller using C. I have a routine to pull 4 bytes off of a CAN bus to read an SPN. I am able to get the 4 bytes but I cannot print the 4 byte number because it is truncating the the first 2 bytes making it a 16 bit…
Eddie
  • 39
  • 10
1 2 3
99
100