avr

Avr asm label*2

我怕爱的太早我们不能终老 提交于 2019-12-19 10:26:08
问题 Hi i am new in avr asm programming,in the example below, i have few questions: 1) Is it label: 8 bit or 16bit long? 2) Why multiplication label with 2 is needed? 3) Instruction LPM is placing their result in register R0? If so, what does that have to do with Z? 4) Can you explaine the quoted text from the provided link: "If the address is not multiplied by two and label is at byte address 0x60 (word address 0x30), Z will point at the code stored there. I hope this clarified the addressing

How can I jump relative to the PC using the gnu assembler for AVR?

烂漫一生 提交于 2019-12-19 10:21:07
问题 I have a binary file that I've disassembled using avr-objcopy. The interrupt vector table looks like: 00000000 : ; VECTOR TABLE 0: 13 c0 rjmp .+38 ; 0x28, RESET 2: b8 c1 rjmp .+880 ; 0x374, INT0 4: fd cf rjmp .-6 ; 0x0 6: fc cf rjmp .-8 ; 0x0 8: fb cf rjmp .-10 ; 0x0 a: fa cf rjmp .-12 ; 0x0 c: f9 cf rjmp .-14 ; 0x0 e: f8 cf rjmp .-16 ; 0x0 10: f7 cf rjmp .-18 ; 0x0 12: c7 c1 rjmp .+910 ; 0x3a2, TIMER1 OVF 14: f5 cf rjmp .-22 ; 0x0 16: f4 cf rjmp .-24 ; 0x0 18: f3 cf rjmp .-26 ; 0x0 1a: f2 cf

Is it possible to generate random numbers using physical sensors?

好久不见. 提交于 2019-12-18 11:02:50
问题 I've heard about people using light sensors, geiger counters, and other physical sensors to generate random numbers, but I'm skeptical. Is there really a way to generate random numbers from taking measurements of the physical world (using an Arduino or any other microcontroller)? If so, would these numbers ever be really random? to clarify: the question is about the feasibility of using microcontroller-gathered data to generate random numbers that could be applied soundly to cryptography-- an

How to store a number in decimal format in avr

陌路散爱 提交于 2019-12-18 09:45:26
问题 I am trying to enter the decimal values using a keypad in ATMega8 Till now I have been able to enter only the integer values The code is given below switch (keyCode) { case (0xee): keyPressed="1"; b=1; a=a*10+b; break; case (0xed): keyPressed="4"; b=4; a=a*10+b; break; case (0xeb): k keyPressed="7"; b=7; a=a*10+b; break; case (0xde): keyPressed="2"; b=2; a=a*10+b; break; case (0xdd): keyPressed="5"; b=5; a=a*10+b; break; case (0xdb): keyPressed="8"; b=8; a=a*10+b; break; case (0xd7):

tinyAVR: best known multiplication routines for 8-bit and 16-bit factors? [closed]

蓝咒 提交于 2019-12-18 05:12:41
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . "Faster than avr200b.asm"? The mpy8u -routine from avr200b.asm for those processors of Atmel's AVR family that do not implement any of the MUL instructions seems pretty generic, but mpy16u looks sloppy for rotating both lower result bytes 16 times instead of 8. Antonio presented a

Can I implement the Factory Method pattern in C++ without using new?

吃可爱长大的小学妹 提交于 2019-12-18 03:39:36
问题 I'm working in an embedded environment (Arduino/AVR ATMega328) and want to implement the Factory Method pattern in C++. However, the compiler I'm using (avr-gcc) doesn't support the new keyword. Is there a way of implementing this pattern without using new ? 回答1: Since the AVR compiler is based on the gcc compiler, it is very likely to support the new keyword. What exactly is the error you're getting. I'm guessing it's a link/compiler error along the lines of an undefined function, namely,

how bad is it to use dynamic datastuctures on an embedded system?

*爱你&永不变心* 提交于 2019-12-17 22:36:49
问题 So in an embedded systems unit, that i'm taking at uni next year, we will learn that dynamic data structures are a bad thing to have in an embedded system program. but the lecture notes don't go into why. Now i'm working on a moderate scale, embedded systems\ 'LURC' controller, mostly just takes advantages of the peripheral of the "Butterfly" demo board for the AVR169MEGA. produced 4 PWM signals to contol servo's and ESC. and also to provide an 9 seg LCD screen. Now I can't think of anybetter

PID feedback & Position Controller with DC motor/encoder

放肆的年华 提交于 2019-12-14 02:03:07
问题 I'm having a hard time getting both PID feedback and positioning to run at the same time. My thought to calculate the RPM is to: start a timer and count encoder pulses using an interrupt. use some simple math to convert to RPM. reset variables used and start over. I can calculate RPM but then I can only call my PID controller after the calculation (however long I want to wait to get good resolution.) This results in very messy code. Is there a simpler method or something I'm missing? Info

C++ Union of a Float and a Byte Array Issue

不羁的心 提交于 2019-12-14 01:29:02
问题 I am working on an arduino (based off the AVR platform) and I have a method that takes in a float and writes it to EEPROM. I have to convert the float to a byte array to interact with EEPROM. I have two functions as follow: void WriteFloatToEEPROM(int address, float value) { union { byte byteVal[4]; float floatVal; } data; data.floatVal = value; for (int i = 0; i < 4; i++) { EEPROM.update(address + i, data.byteVal[i]); } } float ReadFloatFromEEPROM(int address) { union { byte byteVal[4];

Assembly Alarm Clock

南笙酒味 提交于 2019-12-13 10:31:12
问题 I have a question. If my alarmS == 60 i need to switch inc alarmM and reset the alarmS but I have a question increment_alarm_second: inc alarmS ; increment alarmS cpi alarmS , 0x5A ; 0x3C ; Compare alarmS to 60 breq increment_alarm_minute ; If true, jump incMinute swap alarmS ; swap here to save registers ( swap nibbles ) cpi alarmS , 0xA0 ; compares alarmS register to an inverted 10 brlo endIncSecal ; branch if lower then an inverted 10 to endIncSecal incSecTenal: andi alarmS, 0x0F ; does an