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…
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…
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…
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…
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…
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…
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…
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…
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…
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…
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…
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…
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…
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…
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…