Questions tagged [avr]

AVR is the family of microcontrollers used in Arduino boards.

Filter by
Sorted by
Tagged with
0
votes
0answers
249 views

Arduino Timer 0 in fast PWM mode and micros()

I have the same problem as described on this topic I needed to set my prescale factor for Timer0 to 1 so I can get a 62.5Khz PWM out of pin 4 My issue is that now the delays() function on my ...
0
votes
1answer
910 views

How to find the pin map for the LCD 1602 I2C adapter module?

I'm working with I2C to work with my LCD 1602 and the I2C adapter. This module has 16 pins and I don't know how to communicate with it. I2C sends 8-bit packets. What are the commands to deal with this ...
-1
votes
1answer
302 views

Atmega328P and Arduino Studio and Pololu AVR - not working

I have standalone ATMega328p and I'm using external 16MHz oscillator, I hooked up and I triple checked my connections for Pololu AVR programmer and I make sure that I select a proper programmer \ ...
4
votes
1answer
72 views

How does the microcontroller know which clock to use?

I had seen some tutorials on how to assemble an Arduino on a breadboard. They all just place the external crystal oscillator according to the circuit and then, just burn the bootloader and it starts ...
0
votes
1answer
143 views

Equivalent to POSIX mmap() in AVR-libc

Is there an similar function in AVR-libc/Arduino C++ to mmap()? I'm looking for a way to place machine code in memory at runtime and make it executable.
1
vote
1answer
88 views

Can't send Data to LCD1602 with I2C

I've been doing fine with my LCD1602 I2C configuration but I discovered that command and data functions are the same even though I change the RS command/data bit, but the result is the same. This is ...
0
votes
2answers
1k views

Arduino analogWrite source code explanation

The source code for the analogWrite function looks like this: void analogWrite(uint8_t pin, int val) { ... sbi(TCCRnA, COM0x); OCRnx = val; ... } Where n is which timer (0, 1, 2...) ...
2
votes
0answers
460 views

Is it possible to put ATtiny85 to sleep while using TinywireS?

I have an arduino uno as the master I2C device talking to an ATtiny85 as the slave. What I want to do is have the Attiny85 receive a message from the UNO to tell it to power off which will then ...
0
votes
1answer
61 views

Problem with microSD SPI mode in AVR

I'm trying to read a microSD block. But I don't know why it doesn't work. I do: CS_UP; for(uint8_t i = 0; i <14; i++){ /* Send 74+ clocks */ spi_tranceiver(0xff); } _delay_ms(1); /* Wait 1 ms ...
1
vote
3answers
627 views

Problem with transmitting 2 byte data in correct way

I'm using Atmel Studio with Atmega328P. I'm trying to send the decimal number 876 continuously from the micro-controller. This was just to learn. To send 876 I need two bytes which is: 0x036C = ...
1
vote
3answers
223 views

Can I port a project built on Arduino Uno to a standalone ATmega328 using the exact same code?

I'm building an IoT power usage monitor in which the data is logged using a RTC and an SD card module and a web app hosted on an ESP8266 gives access to this data. My question is can I use the exact ...
2
votes
2answers
5k views

ATmega328p hangs on USART RX interrupt

I was able to use USART without interrupt driven and it worked perfectly! However, when I tried adding interrupt on USART_RX_vect, the program does not work as expected anymore. Below is my small ...
1
vote
0answers
174 views

HMC5883L stops reading when x-axis value get to positive value

I've been looking for a solution for this problem for quite a time I tried different I2C libraries; like, I2C master library using hardware TWI interface * Author: Peter Fleury But the same ...
1
vote
3answers
172 views

What's in an Arduino?

I've been using an Arduino Uno Rev. 3 for a few projects and would like to switch to using a bare Atmega328 chip so I can keep everything on the same board. I've seen the Arduino on breadboard ...
1
vote
2answers
590 views

ATmega328p - ISC00 with INT1?

I was reading about external interrupts using the ATmega328p, and I saw in the chip datasheet under the paragraph "Bits 3:2 – ISC1n: Interrupt Sense Control 1 [n = 1:0]" the following table: Value | ...
0
votes
1answer
658 views

I bought ATmega328p with bootloader and I can't erase it

I bought an online deal which had 10x ATmega328p with bootloader installed. I thought I can erase the bootloader once I got the order (I want to write custom task without a bootloader) but my ...
7
votes
2answers
11k views

Basic makefile for avr-gcc

I would like to make a makefile for compiling c programs for the arduino. I am somewhat familiar with make but have never used it with avr-gcc. What is the simplest way I could put the commands below ...
2
votes
1answer
6k views

My Digispark board won't show up in Ports tab in Arduino IDE (OSX)

I bought a Digistump/Digispark board online and when i received it, I plugged it into my iMac to see if it works. I went to the apple in the top left corner and clicked "About this Mac". Then I ...
1
vote
2answers
3k views

Do AVR delay functions (_delay_us() and _delay_ms()) use timers?

I'm trying to determine if the AVR delay functions _delay_us() and _delay_ms() use timers in such a way that I can't use those timers for other functionality in my code. If so, what timer does it use? ...
0
votes
1answer
203 views

I2C begginer with I/O expander with mega328p C code

I've just started with the I2C protocol. I read about it in the datasheet, other documents, blogs and videos. So, I started to develop my code and I think I did my first success, I succeeded to send ...
1
vote
2answers
2k views

Why we can wake Arduino Uno from sleep using only pin 2?

Can we use other pin as an interrupt to wake Arduino Uno from sleep ?
2
votes
2answers
346 views

Is there an ICRn CTC mode interrupt vector?

I can use the CTC waveform generation mode to loop to OCRnA and trigger the corresponding TIMER1_COMPA_vect interrupt. // CTC mode TCCR1A &= ~(1 << WGM10); TCCR1A &= ~(1 << WGM11);...
0
votes
2answers
161 views

How do I use an ATMega 328 (not P) chip with an Arduino board?

I just burned the bootloader on an ATMega328 chip and then I put in on the Arduino board. But when I try to upload a program to it, it says programmer not in sync and programmer not responding. For ...
0
votes
2answers
676 views

Including an arduino library in Eclipse Neon (undefined reference to)

I'm trying for the first time to use Arduino Libraries (Servo.h & Servo.cpp in this case) in Eclipse IDE. So far I've managed to compile and run Arduino code using this tutorial (I suppose many ...
0
votes
3answers
516 views

More speed from ATMEGA328 Internal Clock

I have a board that is designed and produced. It was designed to use an Atmega328 with the internal clock. There is no space on the board to place an external clock. After completing these and testing ...
1
vote
3answers
887 views

Shift Register on ATMEGA328p

I want to learn more about the shiftout function used with Arduinos and used the implementation with my ATMEGA328p. The Setup This is the original shiftout function used in Arduino Programming, ...
0
votes
1answer
683 views

Attiny85 not recognized at windows startup

I'm using an Attiny85 to interact with a computer using an USB connection, and everything works fine except when I restart my computer and the Attiny85 is connected. When Windows end to boot up the ...
1
vote
1answer
156 views

Is setting AVR TWCR for mega328p TWEN in each function necessary?

I found this useful website explaining for to configure and implement the TWI for mega328p, but what I found not so obvious is that in the website they set TWEN in every function, while in the ...
2
votes
1answer
624 views

Building Custom Bootloaders

Recently I was checking out the Atmel's AVR series and I found the Atmega328PB. I am really familiar with Arduino's environment. So I thought if somehow we could bootloader it with Arduino bootloader. ...
0
votes
0answers
23 views

Programming ATUC256L4U using only Arduino ISP

I heard that you can program any AVR Microcontroller by just using Arduino ISP Can I program ATUC256L4U by just hooking it up to Arduino ISP and Caps, Crystals and etc. Or do I need to do some more ...
0
votes
2answers
562 views

Is it possible to use Arduino UNO programmer for other AVR microcontrollers?

I got an Arduino UNO which I started using with microc for avr to add more customizations. I'm wondering if it is possible to use the Arduino UNO programmer to program other AVR microcontrollers (I ...
0
votes
1answer
42 views

What if I detach AVR micro controller from the Arduino Board after uploading program?

What if I detach AVR microcontroller from the Arduino Board after uploading program? Does the microcontroller still have the program on it? Or the program will be deleted? On the board where does ...
0
votes
1answer
474 views

TWI Wire.setClock() on non arduino AVR MCU issue

Using an Atmega168P - programmed by means of avrdude with the .hex file generated by Arduino IDE. The following code sets the 8 MHz Atmega's TWI interface to just 15.625 kHz: Wire.begin(); // ...
0
votes
1answer
176 views

Arduino IDE compiling for non-arduino AVR boards

Using: Arduino IDE 1.8.2 the board manager from https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json an ATmega168P MCU in TQFP I was able to run my code successfully by modifying ...
3
votes
3answers
2k views

Can I compile a sketch for my attiny85 without an arduino board?

I have a lot of Raspberry Pi's laying around, so I want to use those to program my attiny85 chips. The problem is that most of the code examples, libraries, and documentation out there assume you're ...
2
votes
1answer
2k views

Arduino EEPROM retains old data after flashing with a new program

I have a custom 5V 16Mhz Arduino Uno (a breadboard Uno of sorts) that runs the grbl firmware. After the initial flashing I can see all the settings (through the serial monitor) and everything works. ...
0
votes
3answers
667 views

Arduino UNO USART problems

I need to send 6 bytes value from Arduino UNO to the actuator using serial port in order to make it extends. I have added a button to send the data. For example, 0 20 1 1 0 0. The communication ...
0
votes
1answer
135 views

Programming ATMega328p using VP812 programmer (for AVR/Atmel chips)

I bootloaded an ATMega328p (the one that uses the basic Arduino bootloader). Then, I used the VP812 for dumping other programs written in C (in Atmel Studio). The process of erasing, blank test, ...
1
vote
1answer
5k views

How does avrdude burn a bootloader much quicker than the Arduino IDE?

To burn a bootloader to the Arduino Micro (ATMega32u4), I'm using an Arduino Uno with the ArduinoISP program uploaded to it. 1st case: Arduino IDE Very straightforward, using the ArduinoISP sketch ...
-3
votes
1answer
61 views

Pllzz help me with this error i m using Arduino uno r3 on win 10 [closed]

Error picture on screen jdhvdixbdicjdhdojchdishcishcheoshcjd
-1
votes
1answer
1k views

What Are The Differences Between Arduino Language and Standard C for MCU? [duplicate]

What the differences between Arduino language and standard C used for MCU programming (like AVR).I heard Arduino language is C.What happen if i use Arduino language with bare-bones AVR chips.Or with ...
0
votes
2answers
660 views

From Wiring to pure C

I'm using the Teensy 2.0 (atmega32u4) and decided to switch from Arduino IDE with Wiring to pure C. I think it's much more useful to master programming microcontrollers on that level. Wiring seems to ...
1
vote
1answer
58 views

A confusion with setting timers

I was reading a tutorial on timers. My aim is to generate 16MHz pulse output from the pin 8. Here is the code I modified from the tutorial (I use Arduino's ATmega328P): #include <avr/io.h> #...
0
votes
1answer
426 views

A question on physical locations of the registers in ATmega328P

When I read about registers I always encounter the following illustration: So there are 32 registers in the above diagram. They are processor registers. But in the data-sheet of ATmega328P at page ...
-1
votes
3answers
109 views

Problems creating 10Hz pulse wave

I'm trying to make a 10Hz pulse wave output at Arduino's pin 9 by using the following code I wrote: #define F_CPU 16000000UL #include <avr/io.h> //Defines pins, ports, etc. #include <util/...
1
vote
3answers
974 views

Understanding writing to input pins and pull up resistors

I am new to Arduino, and am trying to understand the following code. The question is: Is my understanding correct, or if not, what is happening here? I have to reverse engineer an existing ...
1
vote
1answer
887 views

Analog inputs on ATtiny85 don't work

I want to use a ATtiny85 to check the voltage of two 12 V batteries (later to control a relay). Therefore I'm using the analogRead() function. For programming I'm using an Arduino Mega 2560 board. // ...
3
votes
2answers
239 views

What does an arduino sketch translate to before compilation?

I've been experimenting with Arduino on both esp8266 and AVR chips. The structure of the .ino file usually looks like this: #include "Arduino.h" #include "ESP8266WiFi.h" ##Some includes void setup() ...
0
votes
1answer
1k views

Help: convert Arduino code to avr-gcc code [closed]

I need to convert Arduino code to avr-gcc code. This is code: #include <Servo.h> Servo myservo; void setup() { myservo.attach(11); } void loop() { myservo.write(67); } I use Arduino ...
1
vote
2answers
176 views

Temperature sensor and LCD

I have a project which uses a DS18B20 temperature sensor and an LCD with an I2C interface on it. I have connected the sensor to my micro-controller (the DS18B20 has a 12-bit digital output) to the ...