2,381 questions
2
votes
2
answers
188
views
Why we use PIN & (1<<PBx) to check if PIN is high?
I'm a beginner working on AVR programming on the ATmega328P. I am trying to get input from a button and then control an LED.
void setup() {
DDRB |= (1<<PB5);
DDRB &= ~(1<<PB4);
...
0
votes
1
answer
69
views
“avrdude: verification error; content mismatch” error when programming AVR based microcontrollers
When programming for an AVR compatible micro controller, such as the Atmega328p, you're facing an error after successfully building and uploading a first time, but all subsequent times result in an ...
0
votes
1
answer
67
views
Unexplained build error in IAR Embedded Workbench for Microchip AVR 7.30.5
I am experiencing a very strange behavior of IAR Embedded Workbench for Microchip AVR 7.30.5. When attempting to build a project I get the following output at the end of the build:
When done from GUI:
...
0
votes
0
answers
56
views
yl-69 sensor - adc conversion does not change adch and adcl - avr assembly
The YL-69 sensor(for soil moisture using a comparator circuit LM-393) is functional. When tested with C code on the Arduino IDE, it prints the correct values on the serial monitor. However, when ...
1
vote
1
answer
72
views
Why does AVR-GCC show the line "text+data+bootloader" when compiling the simple LED blinker?
Avr-gcc 7.1, Win10.
When compiling a simple LED blinker C code using avr-gcc, it outputs:
Invoking the avr-gcc is done by hand using:
avr-gcc -g -Os -mmcu=attiny13a -c "Attiny_blink_01.c"
...
0
votes
1
answer
69
views
Switching on 10 LEDs using push button
#define __SFR_OFFSET 0
#include <avr/io.h>
.global main
main:
ldi R16, 0xFD ; Set PD1–PD6 as outputs, PD0 as input
out DDRD, R16
ldi R16, 0x01 ; Enable pull-up resistor on ...
2
votes
1
answer
117
views
Arduino Nano not reading Data from UART Shell properly
Recently I've been getting into bare-metal programming with the Arduino-Nano, and wanted to play around with the UART protocool. I made a simple "shell" using rust on my host machine that ...
-1
votes
1
answer
47
views
I was working with this 7-segs led timer i encountered this error "Invalid opcode 0xFFFF at PC=0x0014" in proteus
.include "m8def.inc"
.org 0x0000
rjmp RESET
.org 0x0020
rjmp TIMER0_OVF_ISR
RESET:
ldi r16, low(RAMEND)
out SPL, r16
ldi r16, high(RAMEND)
out SPH, r16
ldi ...
1
vote
0
answers
96
views
Simavr - ATmega328P timer flags behaving oddly
I am using Simavr to simulate an AVR ATmega328P chip, so I dont know if this is a problem in the simulation or if it happens in the MCU too.
When using the timer0 in CTC mode the TOV0 flag seems to be ...
1
vote
1
answer
104
views
Is there a way to create a static array in the .data section, where its length is calculated by the size of the .bss section on the Arduino?
I'm just wondering if there is a way I can tell the compiler that I want to create a static array inside the .data section of the Arduino's SRAM, where the array's size is calculated using the size of ...
0
votes
1
answer
90
views
AVR Embedded question (rstack and cstack)
I have a project in college where the main in asm has to call a function in c, but I don't know how to initialize the stack (rstack and cstack). I mention that the project is on an atmega16.
Main asm ...
0
votes
2
answers
167
views
Binary size bloats 20x if moved from src/main.rs to examples/
I'm making a library for Arduino Uno in Rust from scratch. Currently, there's a basic Serial.write print example in the src/main.rs, which on compilation is around 500 bytes (cargo b --release).
$ avr-...
0
votes
0
answers
100
views
Rust AVR-atmega328p Assembler global_asm! "jmp addr" Error "instruction requires a CPU feature not currently enabled"
I'm on Rust with AVR atmega328p,
using
nightly-2024-11-12-aarch64-unknown-linux-gnu (default)
rustc 1.84.0-nightly (81eef2d36 2024-11-11)
I have a global_asm! macro which compiles Ok in a bin main....
1
vote
2
answers
96
views
How to get an ATtiny24A MCU into sleep mode?
I am experiencing somewhat a peculiar phenomenon. I am trying to get an ATtiny24A into sleep mode. I had a working code before, but through revisions and testing of other parts of my program it seems ...
0
votes
1
answer
41
views
getting "Invalid opcode 0xFFFF at PC=0x5200" on proteus
this is my code for atmega32 in assembly language. It will toggle led on pd5 after pressing the push button 10 times, but in proteus I am getting this error:
Invalid opcode 0xFFFF at PC=0x5200
I ...