avr

Using a rotary encoder with AVR Micro controller

不打扰是莪最后的温柔 提交于 2019-12-04 13:05:05
问题 I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168. Clarification I have tried using an External Interrupt to listen to the pins, but it seems like it is too slow. When Pin A goes high, the interrupt procedure starts and then checks if Pin B is high. The idea is that if Pin B is high the moment Pin A went high, then it is rotating counter clock-wise. If Pin B is low, then it is rotating

USB programming

倾然丶 夕夏残阳落幕 提交于 2019-12-04 07:46:29
问题 I want to program a microcontroller (AVR) to control some leds through USB. It's just out of interest in how to build and program USB devices. There are some AVR microcontrollers that support the USB protocol or I could implement the USB protocol in an another microcontroller myself, but I wonder what to use to write your own drivers on the computer. My level in system programming: total noob (hence the question) So what is the literature you people would advice to get good knowledge of the

AT+CMGS returns ERROR

末鹿安然 提交于 2019-12-03 19:52:19
问题 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? 回答1: 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.

Using Google 'Protocol Buffers' in Arduino

戏子无情 提交于 2019-12-03 12:27:32
问题 Is it possible to make Google Protocol Buffers work in Arduino? I have been trying for about a week and can't make it work, and I would like to know if it's even possible. 回答1: This should fit on an Arduino: https://github.com/nanopb/nanopb 回答2: I've managed, after several attempts, to compile google protocol buffers for Arduino (using lite runtime), and still, the resulting code size was way over the 32k limit. So, for now, GPB isn't a viable option for Arduino projects. (maybe on Arduino

Mixing C and assembly sources and build with cmake

让人想犯罪 __ 提交于 2019-12-03 11:25:09
问题 I'm using eclipse for building a avr-gcc project that mixes assembly code and C source files. I want to get rid of the automatic makefile generation of eclipse because I need to automate some process into the makefiles and for other reasons. I used cmake some times ago and I was happy with it so I want to try to compile my source files using it. Everything run as expected with C sources. The problem is that at the end I need to compile some assembly files (actually 2) and add them to the

Undefined reference to 'operator delete(void*)'

[亡魂溺海] 提交于 2019-12-03 10:46:00
I'm new to C++ programming, but have been working in C and Java for a long time. I'm trying to do an interface-like hierarchy in some serial protocol I'm working on, and keep getting the error: Undefined reference to 'operator delete(void*)' The (simplified) code follows below: PacketWriter.h: class PacketWriter { public: virtual ~PacketWriter() {} virtual uint8_t nextByte() = 0; } StringWriter.h: class StringWriter : public PacketWriter { public: StringWriter(const char* message); virtual uint8_t nextByte(); } The constructor and nextByte functions are implemented in StringWriter.cpp, but

Faster 16bit multiplication algorithm for 8-bit MCU

淺唱寂寞╮ 提交于 2019-12-03 09:49:07
I'm searching for an algorithm to multiply two integer numbers that is better than the one below. Do you have a good idea about that? (The MCU - AT Tiny 84/85 or similar - where this code runs has no mul/div operator) uint16_t umul16_(uint16_t a, uint16_t b) { uint16_t res=0; while (b) { if ( (b & 1) ) res+=a; b>>=1; a+=a; } return res; } This algorithm, when compiled for AT Tiny 85/84 using the avr-gcc compiler, is almost identical to the algorithm __mulhi3 the avr-gcc generates. avr-gcc algorithm: 00000106 <__mulhi3>: 106: 00 24 eor r0, r0 108: 55 27 eor r21, r21 10a: 04 c0 rjmp .+8 ; 0x114

What's the difference/relationship between AVR and Arduino?

送分小仙女□ 提交于 2019-12-03 09:46:39
I've been interested in hardware programming recently, but I have not started yet. I did some searching working, and have a vague idea: Arduino is a combination of both chip and breadboard. AVR is a single chip, and need to buy a breadboard to get started. Is that statement true or false? kersny AVR is just an integrated circuit microchip, made by Atmel. It looks something like this: Although they can be used by themselves, it takes a bit of hardware experience and some support components. The Arduino is an AVR processor running special code that lets you use the Arduino environment to program

AVRDUDE Android Arduino ioctl error

天涯浪子 提交于 2019-12-03 09:37:33
My previous question, Android cannot talk to Arduino using AVRDUDE , has been resolved. I can now connect my Nexus 7 to my Arduino Uno. The full command I am running is this: /system/xbin/su (getting root here) /data/data/jackpal.androidterm/local/bin/avrdude -F -V -c arduino -p ATMEGA328P -P /dev/bus/usb/002/002 -b 115200 -C /data/data/jackpal.androidterm/local/etc/avrdude.conf -U flash:w:led.hex Here I am trying to put the hex file on the Arduino. I do however get the following error: avrdude: ser_open():can't set attributes for device "/dev/bus/usb/002/002": Inappropriate ioctl for device

Using a rotary encoder with AVR Micro controller

泄露秘密 提交于 2019-12-03 09:07:38
I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder , and I'm using Atmega168 . Clarification I have tried using an External Interrupt to listen to the pins, but it seems like it is too slow. When Pin A goes high, the interrupt procedure starts and then checks if Pin B is high. The idea is that if Pin B is high the moment Pin A went high, then it is rotating counter clock-wise. If Pin B is low, then it is rotating clock-wise. But it seems like the AVR takes too long to check Pin B, so it is always read as high. I've