Questions tagged [atmega]

ATmega is a product line within Atmel's AVR micro-controller family.

The official website can be found here.

819 questions
4
votes
1 answer

Approximation of `atan` function in fixed point

I must do some calculations that need to use trigonometric functions, and especially the atan one. The code will run on an Atmega328p, and for efficiency sake, I can't use floats: I'm using fixed point numbers. Thus, I can't use the standard atan…
Spirine
  • 1,837
  • 1
  • 16
  • 28
4
votes
1 answer

Why Arduino uses interrupt every 1.024ms in millis function?

I am implementing a time counter on my atmega 328p. I looked on the implementation of arduino millis function and I am bit confused, why they use Timer Overflow Interrupt which is executed every 1.024 ms (freg = 16MHz, 64 prescaling), when they…
4
votes
5 answers

Use casts to access a byte-array like a structure?

I'm working on a microcontroller-based software project. A part of the project is a parser for a binary protocol. The protocol is fixed and cannot be changed. A PC is acting as a "master" and mainly transmits commands, which have to be executed by…
lugge86
  • 255
  • 3
  • 11
4
votes
1 answer

Issues with Timers in Assembly [ATmega8]

I've written a programm that Outputs 2 different sounds, taken from 2 Potientiometers. The issue with that is, that a sound is generated by turning the beeper on and off with a delay in it, which is basicly the value of the potentiometer. But the…
Lazy Senior
  • 171
  • 1
  • 8
3
votes
1 answer

Pointer to an element inside a structure ( C )

For the arduino platform, I want to receive 16 bytes and stuff their value inside a structure. Currently I have this code in place if( Serial.available() >= sizeof( newSection ) ) { // if atleast one full struct is received Sections newSection…
bask185
  • 377
  • 1
  • 3
  • 12
3
votes
2 answers

How to pass instance of template to another instance of another template?

I have two class templates that must be templates (C++). I just simplified their code to show the essence of the problem. How to pass an object (obj1) from one template (MyClass1) to another object (obj2) from second template (MyClass2)? I tried…
catgiggle
  • 43
  • 5
3
votes
0 answers

How to control the Led's in a 5*5 Led - Matrix with the help of 5*5 push-button

I want two Led's ( Led 1 and Led 3 ) in a 5*5 Led - Matrix to light up and when the corresponding buttons in the 5*5 push-button are pressed the Led's turns off and another two Led's ( Led 3 and Led 5 ) should light up and when the corresponding…
Paulson Raja L
  • 379
  • 2
  • 11
3
votes
1 answer

Compare uint8_t with hexadecimal in C++

Let's say I have uint8_t bytes[maxBytes];. Now I want to compare the lower 6 bits of the first byte (bytes[0]) with 0x3c. I tried to do it like this: bytes[0] & 0x3f == 0x3c Unfortunately, this did not produce the expected result. (i.e. it's…
Zulakis
  • 7,859
  • 10
  • 42
  • 67
3
votes
0 answers

sorry, unimplemented: non-trivial designated initializers not supported

I am trying to configure ADC on ATMEGA328 with C and I get on this line: FILE usart0_str = FDEV_SETUP_STREAM(USART0SendByte, NULL, _FDEV_SETUP_WRITE); The following error: sorry, unimplemented: non-trivial designated initializers not supported FILE…
John Doe
  • 85
  • 9
3
votes
1 answer

Programming the Arduino in assembly?

I understand that I can program the Arduino in C, but with my current project (a tiny Arduino kernel), I would really rather use Assembly for some sections to both learn Assembly and possibly improve efficiency the SLIGHTEST bit. Is there something…
user7811680
3
votes
2 answers

Why are different pointers and void pointers being used by these functions?

I have an ATMega328 and I'm using the functions to use the inbuilt EEPROM. I can use the EEPROM correctly but I don't understand the function arguments I pass to the EEPROM functions. For example, to write different types of data I…
CS Student
  • 1,613
  • 6
  • 24
  • 40
3
votes
2 answers

AVR ATMega328P ADC channel selection issue

I'm tinkering around with an ATMega328P right now and wanted to read an analogue value from a pin through the ADC and simply output the value to 4 LEDs. Really simple #define F_CPU 20000000UL #include #include #include…
rfreytag
  • 1,203
  • 11
  • 18
3
votes
0 answers

AVR C - step motor and adc code on Atmega32

I am starting with microcontrollers and I am trying to code a voltage measurement of solar panel connected to Atmega32 (with external clock) microcontroller. The solar panel is mounted to the step motor for making the rotation of solar panel…
ruker
  • 31
  • 3
3
votes
1 answer

AmForth needs a re-flash after -13 exception (undefined word)

I have an ATMega328p running AmForth 6.1. While interactively debugging, I accidentally called an undefined word, resulting in AmForth throwing a -13 exception (undefined word). After the exception is thrown, AmForth acts strange. Calls to…
Rick
  • 8,366
  • 8
  • 47
  • 76
3
votes
4 answers

How to delay a output about 15 minutes after pressing a button?

I am learning micro controller programming. I need help to complete my program at WinAVR with Atmega8L-8PU. i have added 3 buttons, when the buttons pressed: first button will supply output for 15 minutes, 2nd one will 30 minutes and the last 3rd…
Sohel
  • 31
  • 4
1 2
3
54 55