The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [avr]

AVR is a 8- and 32-bit microcontroller core developed by Atmel. AVR was chosen as microcontroller for the popular Arduino SBCs.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

What does _SFR_IO8(0x04) is doing? AVR

I'm trying to write a program in assembly to toggle the on-board LED of the Arduino MEGA2560 in assembly. To do so I just have to indicate the direction of the pin (13 in this case which is PB7) as ...
6
votes
7answers
2k views

Compress .hex file for micro-controller [closed]

I am currently writing a program in AVR Studio, here is the build *Memory Usage : * ...
-1
votes
2answers
76 views

Can I use C++ stl in avr-gcc?

I have implemented C++ queue in my codes, those I run on my PC. Now I'm programming an ATmega128 micro-controller to implement a .c code. Can I use that ...
-1
votes
2answers
45 views

Interfacing 4*4 keypad avr-gcc [duplicate]

I have this function for a 4x4 keypad: ...
0
votes
0answers
26 views

Help With ATMega32 Fuses

I decided I wanted to learn Atmel Studio to be able to work with all their microcontrollers problem being i'm trying to use a brand new ATMega32 with default fuse settings and an external crystal ...
0
votes
0answers
36 views

Can I use PWM to control the speeds of more than two motors separately in ATmega32A?

Can I use PWM to control the speeds of more than two motors separately in ATmega32A ? The latest thing I could do is controlling The speeds of two mototrs using fast PWM mode in counter 1 with ...
0
votes
0answers
63 views

AVR ATMEGA168 UART behaving strangely

I am new to AVR and microcontrollers and I am trying to get the UART working correctly on my Atmega68 chip. When I transmit data from my chip my PC terminal program receives them as weird symbols. I ...
0
votes
1answer
52 views

.96 inch TFT with ST7753 and AVR - can't draw individual pixels

I bought this from aliexpress: https://www.aliexpress.com/item/32859042892.html It seems to be a good display, even a bit higher res, than advertised, however, I'm having trouble doing anything more ...
0
votes
1answer
44 views

How to use output PWM in AVR

I have this code to blink an array (8-led) of led one after one: ...
0
votes
1answer
106 views

How to make 1uA consumption on Attiny13a?

I'm measuring my standalone Attinty13a (internal 128kHz) current consumption with li-ion accumulator (3.7v, 220mAh). Here is my schema and code: ...
0
votes
0answers
54 views

ATMega328P - DS18B20 temperature sensor returns incorrect temperature values

I'm using a Dallas DS18B20 sensor to measure temperature in conjunction with an AVR ATMega328P microcontroller (using this AVR C library to implement the code). Unfortunately, the value always returns ...
3
votes
1answer
69 views

AVR diagram of functions calling, ISR and main loop share the same resource

I made a simple diagram of functions calls to illustrate the potential problem which bothering me a little. As you can see, my task_list (which is simple linked ...
0
votes
1answer
59 views

Atmega328p ADC - value keeps returning zero when connected

I'm currently try to connect a DS18S20 temperature sensor to the atmega328p. I have wired AVCC and AGRD to the same power rail on my breadboard as normal VCC/GRD and AREF is not connected. When I try ...
0
votes
0answers
44 views

Strange Clock output on AVR [duplicate]

I have programmed my ATtiny1616 to output the clock on a pin. Here is my reading: Why is there all that ripple? How might I reduce it?
0
votes
0answers
47 views

avr/io.h don't include the appropriate avr/ioXXX.h file

I'm facing a problem on Eclipse IDE that when compiling my project (which has #include <avr/io.h>), the compiler includes ...
1
vote
2answers
50 views

AVR ATMEGA644 print Local time

From this tutorial, I can print local time when I code using codeblock. https://www.tutorialspoint.com/c_standard_library/c_function_localtime.htm I am measuring capacitance by atmega644. I read the ...
0
votes
0answers
37 views

OLED SS1306 displays on one side only when using AVR

I have an I2C 128x64 OLED display here. I've tried using Arduino and everything works flawlessly. Now I'm trying this but just writing in straight-up C code. Majority of the display is garbled up. I'...
1
vote
2answers
107 views

AVR atmega328p - Can I use port C as digital output pins?

I'm currently trying to connect a 7x5 dot matrix to an AVR ATMega328p. I'm already using port B/D and I would like to use port C so that I have extra output pins. My question is, can I use port C as ...
1
vote
2answers
62 views

Simulate Shift Register on AVR (Configurable Logic/Timers?)

Recently I set up two MCUs (ATtiny1616) to perform basic serial communication using shift registers I made myself. simulate this circuit – Schematic created using CircuitLab Here is the logic ...
1
vote
2answers
58 views

Where should be defined a device specific ISR when making a static library?

Suppose I want to make a static library (.a file), which contains an ISR. That library should be used by many AVR MCUs, but each device has different ISR vector name, so it cannot be defined in .c ...
-2
votes
5answers
124 views

Bitwise operations in embedded C if button pressed on AVR circuit

I am using ATmega32 AVR microcontroller. I am confused about bitwise operation in embedded C. I understand (AND, OR, XOR, NOT) logic gates very well, but there is something that I don't understand: I ...
0
votes
1answer
36 views

What is the difference between ADC single conversion mode and free running mode in ATmega32A?

Can someone explain this to me as I don't get what's written in this section of datasheet A piece code written in C showing the difference would be great too . thanks in advance.
0
votes
1answer
57 views

Programming ESP8266 in circuit

I've designed a simple WS2812B LED Controller utilizing the ATMega328p and an ESP8266 to connect to WiFi. The two are supposed to be communicating over UART. I've made a mistake of not testing the ...
0
votes
0answers
56 views

Atmega328p datasheet mistake “OCRA”

I was reading the atmega328p datasheet, and suddenly, i saw that a register is mentioned called "OCRA", on page 108 and page 160, which normally, should be register "OCR0A", which is widely mentioned ...
0
votes
1answer
59 views

What is best sources for learning and practising AVR microcontrollers? [closed]

I am computers and systems engineering student and I am very interested in microcontrollers so What is best sources for learning and practising AVR microcontrollers ?
0
votes
1answer
76 views

Thread-Style Operation on Microprocessor

This is a general question about designing firmware for AVR microcontrollers, say, the AtMega16. I have a routine that I am running through several thousand times per second. The routine is entirely ...
0
votes
2answers
81 views

Atmel AVR cutting down the power

This might be a straight forward question: An AVR gets its power from a regulator which can be turned off with a digital low level input. However on a spike (digital high followed by digital low) the ...
6
votes
5answers
922 views

What's the maximum time an interrupt service routine can take to execute on ATmega328P?

I have an ATmega328P that checks if a button was pressed via pin change interrupts. Now, I want to turn on an LED for 200 ms. Can I just turn the LED on, wait 200 ms and turn it back off in ...
1
vote
1answer
58 views

serial monitor error/crash

After typing C, microcontroller responds with # Next, I type k, microcontroller responds with #INFO: TWI master enabled Next, I type !, microcontroller responds with C after typing in the next ...
0
votes
0answers
60 views

Switch Like Microcontroller or Integrated circuit

I'm somewhat new to this, and just wondering what the best approach would be. I'm trying to make a device that would be put in the middle of 2 connectors with about 20 wires. Essentially I am ...
0
votes
1answer
57 views

Making UART between ATmega32A and the PC :

I used PL2303hx to connect my PC to the chip and I did the correct connections and installed the driver of the IC and the program I wrote was simulated succesfully on proteus: But when I do it on the ...
0
votes
2answers
41 views

Common resistor for pulling up unused pins of ATmega2560

I am designing a PCB with ATmega2560 MCU. I have 50 unused pins in my design. I was wondering if I can pull up these 50 pins using 5 resistors such that 10 pins have a common pull up resistor. Is that ...
1
vote
0answers
51 views

AVR - Timer0 is not firing if INT5 is enabled in EIMSK

I'm using an ATMEGA2560. Compiler: avr-gcc (AVR_8_bit_GNU_Toolchain_3.4.5_1522) 4.8.1 I have setup TIMER0 for periodic tasks: ...
1
vote
2answers
57 views

ATMEGA328 Serial input via ISR to buffer - buffer messed on printout

Using an ISR on the atmega328 to read a string ended by a \r from UART and echo back the readout string afterwards ...
2
votes
1answer
46 views

How to include paths for the C compiler in atmel studio?

I have a folder project and it consists of multiple folder and .c and .h files what is the best way to include them all without including the individual folders?
0
votes
0answers
40 views

MEGA2560 only starts program after pressing RESET button multiple times

I am working on a program where I am controlling an MP3 player by using UART between my MEGA2560 and the MP3 player. The MEGA2560 sends serial commands to the MP3 player when external interrupts are ...
0
votes
2answers
104 views

Why SS pin must be set to OUTPUT for SPI master?

In SPI, SS pin is used as latch, which means that it must be set as OUTPUT. The matter is that on arduino micro a LED is attached to the SS pin (aka PB0), so I cannot use it for the latch in SPI. ...
0
votes
1answer
95 views

(Noob question) Placing parts of a byte in different (parts of) registers

Background: I'm trying to get a gLCD working with an Atmega328p. I got it to work quite easily, but there was one catch: the library that I found, used portB for the datapins. This was unacceptable, ...
0
votes
1answer
88 views

SPI and UART of atmega32 were not working when atmega32 was interfaced with ad7705

I was trying to read 16bit ADC ad7705 by atmega32 and send the value read through SPI communication of atmega32 to real-term software by using UART of atmega32. I found that there was no transmission ...
2
votes
1answer
76 views

How to upload code to AtMega2560 using JTAG ICE 2.0

Background : I'm used to code in Arduino(Uno, Mega, Esp32, Esp8266). But this time i have to code directly on AVR Atmega 2560 Chip. I have AVR JTAG ICE 2.0 (like this one) and download several ...
0
votes
0answers
23 views

Voltage drop on system activation

My question is generic in nature about electronics system design. I am trying to put together an RC car which is powered by an AVR Atmega168 chip. It communicates through an HC-12 module and has a ...
0
votes
1answer
49 views

AVR ISP not working, strange signal level [closed]

I can't read the chip ID of the ATMega16m1 MCU using a AVRISP mkII programmer. The ISP pins are connected directly to the MCU, the reset line has a 10k pullup to Vcc (3.3V). When measuring the ISP ...
0
votes
1answer
123 views

What could cause a microcontroller on a board not to accept programming?

EDIT: To summarise - when I take the microcontroller off the board, it works. But when I leave it on the board and try to program it, I cannot. I have designed a PCB and had it fabricated. This PCB ...
1
vote
0answers
51 views

AVR SPI stops clocking if the main loop contains a delay

I have a weird issue here using an ATMega48: ...
0
votes
0answers
52 views

Display sine wave on oscilloscope with avr atmega164

I want to display a sine wave on oscilloscope using AVR Atmega164, but when I put the oscilloscope on the pin OCR0A, it takes me an rectangular pulse. How can I display a sine wave? I will put my code ...
-1
votes
1answer
32 views

Issue with timer_func() and delay_func() in generic library for R551 Fingerprint Sensor - ATMega328p

Apologies for the long-winded question. I've recently stepped outside of the Arduino realm for hardware programming. I'm working on a project that interfaces a R551 Fingerprint Sensor with an ...
0
votes
1answer
65 views

Atmega32u4 constant `1023` reading on ADC Channel

I can't share the schematics as they are not mine, I'm trying to add an analog thumbstick (4 pins, Vcc/GND/x/y) to my atmega32u4 powered keyboard. The thumbstick pins are connected to pins PB4 (ADC11)...
0
votes
0answers
65 views

Cannot Disable AVR ATmega32 Watchdog

I'm writing a code to enable and disable the watchdog timer in ATmega32. I'm using the function in the datasheet that disables the wdt. Also, I'm toggling led in the beginning of the code to know if ...
0
votes
3answers
149 views

Transmission from atmega32 to PC using max232 not working

Transmission from atmega32 to PC using max232 not working. When I checked the data from the Tx pin (in the realterm software) of atmega32 it was fine. But there was no output data from max232, when I ...
0
votes
1answer
90 views

How to detect the phase sequence of a 3-phase ac (R-Y-B or R-B-Y) using Atmega32?

I am using an 8-bit AVR microcontroller in my project to detect the phase sequence of a 3-phase AC supply. Which method shall I use to do the work with the least number of components required along ...