Questions tagged [atmega328p]

This tag should only be used with questions about the ATmega328p microcontroller. Questions about other ATmega series MCUs should use the tag "atmega", and those about the use of the ATmega328p within the Arduino UNO should use the tag "arduino". It is acceptable to use this tag with specific variants, like the ATmega328, ATmega328P-PU, etc.

331 questions
28
votes
5 answers

Due to overcurrent, shouldn't I be extremely cautious when setting an I/O pin as Output?

The question can be applied to any microcontroller with I/O capabilities, but I’m currently working with the popular ATmega328p. Consider the following circuit: A simple SPST Normally Open switch with a 10k pull-up resistor and a ceramic capacitor…
17
votes
2 answers

Seven-segment display seems to draw little current

I bought a 1.8-inch seven-segment common cathode LED display from AliExpress. So no datasheet available. I used a 1 kΩ resistor and a 5 V source, as to put a max 5 mA in the LED. I measured 1.6 V for the decimal dot, and 3.5 V for each segment. The…
mathieu
  • 295
  • 2
  • 9
7
votes
2 answers

What is the '0x04' next to 'DDRB' in the ATmega328 datasheet?

I was trying to change the value of DDRB by its memory address with the following code: *(volatile byte*) 0x04 = 0b00100000; It did not work. I got the value 0x04 from a post on the Arduino forum, and they claim to have gotten it from the datasheet…
luek baja
  • 259
  • 1
  • 6
7
votes
2 answers

Why doesn't my VGA implementation using an AVR microcontroller work?

Problem I'm trying to generate the appropriate signal output for interfacing an AVR ATmega328P microcontroller with an LCD monitor, via the VGA specification. The VGA specification I am trying to meet is the industry standard 640*480 with 60 Hz…
Tom Finch
  • 81
  • 4
7
votes
1 answer

Atmega328P - How is brown-out-detection supposed to work?

[SOLVED][UPDATE]: The problem was with fuse bits. Somehow the fuses were being incorrectly written as 0xFE rather than 0xFD. FE corresponds to 1.8V and thus arduino board was working down to 1.8V. I reinstalled Arduino and started everything from…
Whiskeyjack
  • 7,946
  • 8
  • 53
  • 91
6
votes
1 answer

How does USART know which port to use for IO?

I'm trying to learn to use USART on an ATmega328P. I'm using this datasheet. I'm using the following code to echo characters I type on my terminal: #include #define BAUD 9600 #define F_CPU 16000000UL static void usart_init(void) { …
kovac
  • 343
  • 1
  • 8
6
votes
7 answers

Compress .hex file for micro-controller

I am currently writing a program in AVR Studio, here is the build *Memory Usage : * Device: atmega32 Program: 9304 bytes (28.4% Full) (.text + .data + .bootloader) Data: 334 bytes (16.3% Full) (.data + .bss + .noinit) As…
Danial
  • 223
  • 2
  • 6
6
votes
5 answers

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 the ISR like in the following code? ISR(PCINT1_vect) { …
thebear8
  • 73
  • 1
  • 4
6
votes
2 answers

LED- Resistor, does the position matter?

I was reading the MAKE AVR programming. One of the chapters suggests to solder resistor to the cathode side of an LED. But in our uni labs it's said to connect the resistor "before" the LED; that is connect the resistor to the anode. Does the…
Yasha
  • 105
  • 4
6
votes
1 answer

Why did this arduino burn out? SilentStepStick (TMC2130) stepper at 24V

I'm new to electronics. Attempting to bench-test a SilentStepStick stepper driver board, (based on a TMC2130) Using: Arduino Uno, a SilentStepStick driver board, a 0.6A stepper motor, and waterott example code (using SPI). The motor turned as…
Mtl Dev
  • 225
  • 3
  • 13
5
votes
2 answers

automatic submersible pump actuation project

I have a project for automatic submersible pump actuation using a microcontroller. I've done for two voltages like 5 V and 12 V and its corresponding relay. Also, in each board there is a transistor circuit for the motor actuation. It's nothing…
5
votes
4 answers

Does the output bypass capacitor of an LM7805 double as a decoupling capacitor?

I'm using a 5v linear regulator (specifically an LM7805) that outputs directly to an ATMEGA328P. According to the LM7805 datasheet (page 23) input and output bypass capacitors should be used, as seen below, to tame peaks and ensure stability. It…
4
votes
3 answers

Running barebones ATMEGA328P on 3.7 V battery

I have some questions regarding running an ATMEGA328P from a 3.7 V battery. These batteries can vary their voltage during discharge from 4.2 V to 3.0 V. So my questions are: If I power the ATMEGA328P directly from the battery, what would the…
Dan Alvarez
  • 315
  • 1
  • 13
4
votes
4 answers

Possible to buy Atmega328p with programmed Flash and EEPROM?

I've recently upgraded my old project that goes to mass production (a pair of thousand pieces, pretty niche). Previously I used DIP atmega328p, which were manually programmed in China. I sent them a detailed instruction, HEX of Flash and HEX of…
Ilya
  • 3,478
  • 7
  • 33
4
votes
0 answers

Please help with my custom ATMega328 PCB

I created a PCB for my newest Arduino project and its driving me mad by now. I am through several PCB variations and tried connecting to it (via FTDI first - then) via ISP but I fail every time and in each revision. Tested all the pads/pins for a…
skaman82
  • 41
  • 3
1
2 3
22 23