Tagged Questions
2
votes
2answers
110 views
Understanding volatile class fields in AVR C++ programs
I'm having some confusion about what members to declare volatile in a program I'm writing in C++ for an AVR microcontroller, with interrupts. When it's plain C it makes sense - the compiler doesn't ...
1
vote
1answer
34 views
How to flash error if a macro is not defined in program
I want my program to flash compile time error like "LCD_PORT not defined" if it is not defined in program itself. For that I modified the header file like this
...
1
vote
0answers
59 views
How to get rid of “Invalid opcode 0x002A at PC=0x004” in ISIS Proteus?
I have used ATmega 8 and have simulated a circuit to use interrupts, when i give an external interrupt i.e. when a push button is pressed all the LEDs connected to PORTB supposed to be lit up, but i ...
1
vote
1answer
80 views
AVR Time Delay without Arduino Libraries
Trying to figure out how to do something like delay() in Arduino but just for straight AVR code. What's the typical way to do waits and such on AVR chips?
6
votes
2answers
226 views
Program AVR EEPROM directly from C source
When you include the following code in an AVR C source, you can apparently directly program the fuses, without the need for an extra command or .hex file:
...
5
votes
2answers
177 views
Decoding multiple quadrature rotary encoders
Scenario
I have 4 ACZ16 quadrature rotary encoders connected to GPIO Port D on an ATMega168P. I am only trying to extract rotation direction from them. Position is irrelevant, and it is guaranteed ...
1
vote
2answers
231 views
AVR GCC : Global / Static Array not getting initialized properly
Im having problem with global arrays in my C code. What i am trying to do is to use a display buffer (array of 8 uint8_t with each uint8_t representing a row) to light up the leds in 8x8 led matrix ...
2
votes
1answer
153 views
ATMega168 SPI tranmission will not start
Scenario
I have an ATMega168 using an external 10MHz crystal. The DIV/8 fuse bit is not set. The processor takes the outputs from 4 quadrature rotary encoders. Their rotation direction information is ...
4
votes
2answers
124 views
Turn on and let LED stay on if value is over threshold in main while-loop
I'm totally stuck with this rather trivial (?) problem, i've got this pseudo code that i will convert to C (i'm programming a ATmega8 MCU):
...
1
vote
2answers
365 views
Measuring 32V using ADC of Atmega8
I'm trying to measure the battery voltage of 30V using the ADC of an AVR Atmega8, AVCC is connected to 5V.
I connected a suitable voltage divider: R1 is 270k, R2 is 10k. The result I get is wrong at ...
3
votes
1answer
154 views
PROGMEM data vs. calculated data
On an arduino project I'm working on (ATMega328 at the moment) I have a bunch of vector distance data that I need to use for various pixels in a matrix.
It's a relatively simple calculation:
...
25
votes
2answers
737 views
Who receives the value returned by main()?
I know that in computers, value returned by the main() function is received by the operating system.
But, what happens in the ...
1
vote
1answer
441 views
Converting from int to string for AVR ATmega32
I am trying to read data from the ADC and display it on a HD44870 compatible LCD with an ATmega32. As the data from the ADC is a 10-bit unsigned integer, the LCD expects a string, some conversion is ...
6
votes
1answer
220 views
Time Base ISR Concurrency
This is sort of a "classic" problem, and I think I have a solution, but I want to vet it with this community. I am building a project using the ATtiny88 microcontroller, and I'm programming in ...
3
votes
2answers
261 views
avr attiny84: wrong delay
I'm pretty new to avr programming. I'm facing a strange problem that I can't solve so far.
I've wrote a simple code:
...