avr

Best platform for learning embedded programming? [closed]

巧了我就是萌 提交于 2019-12-02 14:55:52
I'm looking to learn about embedded programming (in C mainly, but I hope to brush up on my ASM as well) and I was wondering what the best platform would be. I have some experience in using Atmel AVR's and programming them with the stk500 and found that to be relatively easy. I especially like AVR Studio and the debugger that lets you view that state of registers. However, If I was to take the time to learn, I would rather learn about something that is prevalent in industry. I am thinking ARM, that is unless someone has a better suggestion. I would also be looking for some reference material, I

Calculating delay from 3 nested loops

夙愿已清 提交于 2019-12-02 07:39:16
My exercise: •Calculate the maximum delay possible using three loops @ 1 MHz clock frequency. (Answer 49.94 s) delay: ldi r23,$FF ;Initialise 3rd loop counter loop3: ldi r24,$FF ;Initialise 2nd loop counter loop2: ldi r25,$FF ;Initialise 1st loop counter loop1: dec r25 ;Decrement the 1st loop counter brne loop1 ;and continue to decrement until 1st loop counter = 0 dec r24 ;Decrement the 2nd loop counter brne loop2 ;If the 2nd loop counter is not equal to zero repeat the 1st loop, else continue dec r23 brne loop3 ret ;Return I'm trying to calculate the maximum delay using those 3 loops the

Why am I only receiving the first address byte? (I2C Protocol)

家住魔仙堡 提交于 2019-12-02 04:44:19
Expecting the slave to ACKnowledge and return data, but it does not. This is my protocol . This is my Datasheet The datasheet mentions "The slave will answer by sending bytes with MSB first. Byte0 and byte1 contain the prediction value. All bytes are acknowledged by the master." Edit: Source Library Also FYI I'm on an Arduino Fio but I am not inheriting the Arduino library. #include <avr/io.h> #include <util/delay.h> #include <stdlib.h> #include <uart.h> #include <i2c_master.h> #define LED PB5 #define I2C_READ 0x5A char buffer[1]; //char data[9]; uint16_t val = 0; uint8_t status = 0; void

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

偶尔善良 提交于 2019-12-01 11:29:15
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 rjmp .-28 ; 0x0 1c: 2b c2 rjmp .+1110 ; 0x474, ADC conversion complete 1e: f0 cf rjmp .-32 ; 0x0 20:

Compilation gcc 4.6.2 (cannot compute suffix of object files)

二次信任 提交于 2019-11-30 17:37:07
Problem when compiling gcc 4.6.2: checking for avr-gcc... /data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/ -B/data/data6/soft/programming/gcc-avr/avr/bin/ -B/data/data6/soft/programming/gcc-avr/avr/lib/ -isystem /data/data6/soft/programming/gcc-avr/avr/include -isystem /data/data6/soft/programming/gcc-avr/avr/sys-include checking for suffix of object files... configure: error: in `/data/data6/soft/src_build/gcc-4.6.2/avr/libgcc': configure: error: cannot compute suffix of object files: cannot

How does an AVR perform floating point Arithmetic

为君一笑 提交于 2019-11-30 15:37:48
I'm trying to implement a support for double and float and corresponding basic arithmetic on a CPU without an FPU. I know that it is possible on all AVR ATmega controllers . An ATmega also has no FPU. So here comes the question: How does it work? If there any suggestions for literature or links with explanations and examples? At the best case I will provide a support for code like this: double twice ( double x ) { return x*x; } Many thanks in advance, Alex Here are AVR related links with explanations and examples for implementing soft double: You will find one double floating point lib here .

AT+CMGS returns ERROR

烈酒焚心 提交于 2019-11-30 11:36:52
I am using SIM900 GSM module connect to my AVR Microcontroller. I tested it with FT232 to see transmitting data. First Micro sends AT it will response OK AT OK AT+CMGF=1 OK AT+CMGS="+9893XXXXXX" returns ERROR and doesn't show ">" Could anybody advise me what to do? Command AT+CSCS? will answer You what type of sms-encoding is used. Properly answer is "GSM", and if not, You should set it by command AT+CSCS="GSM" . And remember about "Ctrl+Z" (not "Enter") as a finish of sms text, please. You aren't passing all the parameters to the command. The command format is: AT+CMGS=<number><CR><message>

#define a tuple in C

久未见 提交于 2019-11-30 03:50:19
问题 I want to be able to define a tuple which represents the arguments needed by other macros. I think the best way to show what I want is to show an example: #include <avr/io.h> #define LED_PORT PORTB #define LED_DDR DDRB #define LED_PIN PB7 #define LED LED_PORT, LED_DDR, LED_PIN #define OUTPUT(port, ddr, pin) ddr |= 1 << pin void main(void) { OUTPUT(LED); } I want OUTPUT(LED) to be then expanded into: LED_DDR |= 1 << LED_PIN The problem that I get is to do with the order of expansion, and

Compilation gcc 4.6.2 (cannot compute suffix of object files)

ε祈祈猫儿з 提交于 2019-11-30 02:10:19
问题 Problem when compiling gcc 4.6.2: checking for avr-gcc... /data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/ -B/data/data6/soft/programming/gcc-avr/avr/bin/ -B/data/data6/soft/programming/gcc-avr/avr/lib/ -isystem /data/data6/soft/programming/gcc-avr/avr/include -isystem /data/data6/soft/programming/gcc-avr/avr/sys-include checking for suffix of object files... configure: error: in `/data/data6

Is it possible to generate random numbers using physical sensors?

孤街醉人 提交于 2019-11-30 00:35:03
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 alternative to relying on a device's entropy. Taking analog "real world" measurements usually is a