Questions tagged [avr]

AVR is the family of microcontrollers used in Arduino boards.

Filter by
Sorted by
Tagged with
1
vote
1answer
53 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
353 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
vote
3answers
433 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
votes
3answers
96 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
181 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 ...
1
vote
3answers
839 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
620 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
164 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 ...
2
votes
1answer
6k views

How to convert Arduino example sketch to a complete c++ project?

I'm experimenting something new with my Arduino Leonardo. I removed its original bootloader and flashed it with LUFA mass storage example with added functionalities(now its a firmware). I'm trying to ...
0
votes
2answers
153 views

Using Arduino libraries for adding more functionalities to a bootloader

I have a short question to ask before putting time for research. I have an Arduino Leonardo with the LUFA mass storage bootloader flashed. Now what I need to do is to add more functionalities to the ...
3
votes
1answer
2k views

How is the bootloader activated when device is running?

For the sake of specificity I am referencing my question to Arduino. It applies to all AVRs with hardware USB and a bootloader though. The bootloader is capable of receiving new program data over the ...
0
votes
1answer
108 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
4answers
1k views

Reset and Remove Arduino ATmega328P?

So I have 2 Arduinos, and im wanting to remove the chip from one and reset it to like it came from the factory and then breadboard it and attempt to program it using an AVR programmer (Or maybe an ...
0
votes
1answer
153 views

Problem with uploading LUFA MassStorage .hex file to Leonardo

I have been trying to make my Leonardo board to work as a USB device. So I started with compiling the open source LUFA USB library demo "MassStorage" for the Leonardo board settings. Since I'm using ...
0
votes
1answer
22 views

8 bit arduinos: What happens to the data in registers during a function call? During an interupt?

If I have one function that uses registers heavily calling another that does the same thing, what happens? Does the data get destroyed? What, then, would happen on return to the first function? Is ...
1
vote
2answers
166 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 ...
0
votes
1answer
3k views

10 bit PWM on Arduino UNO

I am using this code to make 10 bit PWM on port number 9, it seems like everything printed is 0,1022 rather than printing 0, 512, 1023. Is there a problem in my code ? I wired pin9 to A3 to get the ...
0
votes
1answer
57 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
1answer
2k views

AVR timer overflow interrupt not working

My problem is an interrupt service routine (ISR) that seemingly never executes! Here's some info on my set up: I am flashing an avr attiny85. I have the bare bones of a project set up so far with ...
0
votes
1answer
113 views

avr-gcc -D is ignored

Im trying to use XCode to compile avr program with arduino libs but seems like something wrong with my Makefile because it throws me warnings like # warning "F_CPU not defined for <util/delay.h&...
0
votes
2answers
960 views

Arduino uno board not detected when connected via USB no matter what OS

I was working with Arduino in Win 8.1, when suddenly it stopped work. I tried to reinstall the drivers and IDE several times, but it didn't solved. In Win 8.1, when I plug the arduino, I get the pop ...
0
votes
1answer
154 views

Using Atmel Studio with Arduino Starter Kit (Uno MCU)

Can someone tell me if it's possible AND safe to use Atmel Studio with Arduino Starter Kit? I'm a newbie to firmware in general and I don't want to "brick" my Arduino Uno Microcontroller. I don't ...
0
votes
1answer
353 views

BASCOM-AVR stk500_2_ReceiveMessage(): timeout: -1

Arduino Uno R3 Windows 10 Bascom AVR The ON is alright. The LED flickers now and then. The RX and TX flickers when I press the program button on Bascom but then disappears almost immediately. ...
0
votes
2answers
529 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
2answers
2k views

AVR (Arduino Uno) Serial.print and Serial.println only printing 1 or 2 chars

I first used the Arduino IDE but now I'm using PlatformIO which is awesome. But I have some big trouble with Serial.print() and Serial.println(). To show this error I have the following example code: ...
1
vote
1answer
764 views

Atmega328p programming with Arduino libraries

I'm trying to use the serial communication to work between a naked AVR Atmega328p and a computer (OS X and Linux Ubuntu). I can program the atmega (using a pololu programmer), I make it blink a LED ...
2
votes
1answer
1k views

Uploading .hex to ATTiny13 using Arduino

I would like to upload a .hex to ATTiny13V (or '13A) using Arduino Uno R3. I think I know everything to do, but ATTiny13 ISP support and Arduino IDE is a bit search-and-find, and I have some grey-...
0
votes
3answers
2k views

Why can't the Atmel ATtiny family delay over a minute?

I have some really simple code and tested on an 8 MHz ATtiny85 and ATtiny2313. It's basically a blocking blink: int relayPin = 7; long offPeriod = 1 * 60 * 1000; long onPeriod = 1 * 60 * 1000; ...
2
votes
1answer
89 views

Issues graduating to AVR-C [closed]

I'm trying to make the transition from coding in the Arduino language to AVR-C, but I'm having some issues with my microcontrollers. I don't have an ISP, so I'm using one of my Arduino UNOs with the ...
-1
votes
1answer
247 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 \ ...
0
votes
3answers
800 views

Is the Arduino bootloader really the Atmel bootloader? Can I use Flip to upload?

I've been asked to do a small project using an Ada BlueFruit board. It has a ATMega32U4. The 32U4 comes from the factory with a bootloader pre-installed. I've never used an Arduino before, but I have ...
1
vote
1answer
62 views

Complete Bread board arduino

I bought a ATmega328 microcontroller and burn the bootloader. Now I want to upload code directly from pc to the microcontroller on bread board. I have max232 ic for the communication but I recently ...
2
votes
5answers
1k views

Good book/reference for AVR coding in pure C/C++?

Can someone recommend a good book/reference for going vanilla (i.e. not using arduino simplified language) on e.g. ATtiny85? I will need to use the equivalents of analogRead() and digitalRead() quite ...
2
votes
1answer
413 views

Cannot enter programming mode on Arduino Uno

I have an Arduino Uno that I've been programming with an AVR Dragon through Atmel Studio 7. I did two things in close proximity, and I'm not entire sure which action is the culprit. I tried using the ...
0
votes
2answers
455 views

does eeprom_write_block function of avr.eeprom.h writes a NULL terminated string or we have to manually null terminate it

http://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html I am trying to figure out that if we use eeprom_write_block function or eeprom_update_block function do we need to manually null ...
1
vote
1answer
119 views

Unable to replicate Arduino code into ATmega8 code

I am trying to replicate an LTC Audio Decoder code from Arduino Uno into AVR ATmega8 which I got from here. My Arduino Uno code is working great. Here is my Arduino Uno code: #define one_time_max ...
0
votes
1answer
267 views

Porting ATMega8 AVR based program to Intel Curie Processor

I'm currently trying to port a program called 'ArduinoUSBLinker' to work on my Arduino 101 (which has an Intel Curie CPU instead of the standard ATMega CPU). The program is used to flash ESCs without ...
2
votes
5answers
223 views

can homemade arduino be powered up with battery?

I am new to arduino. It is costly for me to buy an arduino uno board. Therefore I am going to make a Arduino with breadboard at my home. I also want to make my Arduino portable. Arduino Uno boards can ...
0
votes
1answer
46 views

IO Control and Configuration

I am using Eclipse to program a ATMega2560 and would like to stay away from the Arduino library, While looking through AVR Examples I have seen the syntax #include <avr/io.h> PORTD.0 = 1 or ...
-1
votes
1answer
201 views

AVR has no vprintf_P?

Well this was unexpected. AVR libc has many the variants of printf, including vprintf, but is missing vprintf_P. Is this really just not present or implemented elsewhere?
3
votes
1answer
924 views

How to use printf with Arduino's serial ports without an intermediary buffer?

How to use printf with Arduino's streams without an intermediary buffer? The following seems unnecessary: char buf[256]; sprintf(buf, ...); Serial.print(buf); Is there a way to connect ...
1
vote
0answers
41 views

Why am I only receiving the first address byte? (I2C Protocol)

Expecting the slave to ACKnowledge and return data, but it does not. This is my protocol. This is my Datasheet. Also FYI I'm on an Arduino Fio but I am not inheriting the Arduino library. #include &...
1
vote
1answer
195 views

How do I use SNAP protocol, correctly?

I've reviewed the documentation I'm still a little lost when it comes to applying the functions. Each of the redundancy check methods take in an unsigned char and return an unsigned char. Shouldn't ...
1
vote
1answer
1k views

How do I use an AtTiny85 (or other AtTiny) with Arduino?

Please mind that this is an "example" question. How to make a "tiny arduino"? I've ordered a bunch of ATtiny85's off E-bay, they're like tiny Arduino's. I've set up the latest Arduino IDE and would ...
1
vote
0answers
684 views

Does Proteus simulate external interrupts properly using Arduino? I can't get them to work

I am trying to simulate an interrupt with an Arduino Uno in Proteus. This is the simple test code that I'm using: void introutine() { digitalWrite(13,HIGH); } void setup() { pinMode(13,OUTPUT); ...
1
vote
1answer
121 views

Using AVR Timer Within an ISR

I'm trying to create an ISR which operates for 15 seconds when a particular button is pressed. I'm attempting to use the AVR functions on my Arduino Uno to start counting when it enters the ISR, then ...
0
votes
2answers
115 views

Programming an ATtiny85

Recently I ordered some ATtiny85's from Jameco, and I've been trying to upload code to them through an Arduino Uno, following the instructions from this video on YouTube. I've been getting a lot of ...
-1
votes
1answer
1k views

Error uploading to ATtiny

I followed Great Scott's video on YouTube for uploading to an ATtiny85. When I tried I got the following error messages: Arduino: 1.6.7 (Windows Vista), Board: "ATtiny85 (internal 8 MHz clock)" ...
0
votes
1answer
642 views

Timer/Counter programming Arduino

I'm trying to blink an LED on an ATMega328P (same MCU as Arduino I think..) using the internal timer but I'm stuck since it doesn't seem to light the LED at all.... #include <avr/io.h> //#...