microcontroller

What are traps?

谁都会走 提交于 2019-12-03 10:30:30
There are many different types of traps listed in processor datasheets, e.g. BusFault, MemManage Fault, Usage Fault and Address Error. What is their purpose? How can they be utilized in fault handling? Traps are essentially subroutine calls that are forced by the processor when it detects something unusual in your stream of instructions. (Some processors make them into interrupts, but that's mostly just pushing more context onto the stack; this gets more interesting if the trap includes a switch between user and system address spaces). This is useful for handling conditions that occur rarely

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

Do interrupts interrupt other interrupts on Arduino?

人盡茶涼 提交于 2019-12-03 09:43:27
I have an Arduino Uno (awesome little device!). It has two interrupts; let's call them 0 and 1 . I attach a handler to interrupt 0 and a different one to interrupt 1, using attachInterrupt() : http://www.arduino.cc/en/Reference/AttachInterrupt . Interrupt 0 is triggered and it calls its handler, which does some number crunching. If interrupt 0 's handler is still executing when interrupt 1 is triggered, what will happen? Will interrupt 1 interrupt interrupt 0 , or will interrupt 1 wait until interrupt 0 's handler is done executing? Please note that this question specifically relates to

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

Using Microhip's MLDP data streaming from Android or iOS

青春壹個敷衍的年華 提交于 2019-12-03 07:24:36
Microchip defined a way to stream data over BlueTooth low energy (BLE) and called it MLDP (Microchip Low-energy Data Profile). They built it into their RN4020 chip, and there is even an sample Android app . However, I can't find any specification of how the protocol works or source for the app. I'd like to be able to use it to debug an embedded device from Android and/or iOS. Does anyone know the specification for this protocol or software that implements it? Hi i was in the same problem, but at this moment i have a working code with MLDP, first you need to go to the Module web page: http:/

Whats the best resource to learn Assembly language for PIC microcontroller's [closed]

孤者浪人 提交于 2019-12-03 07:21:49
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I'm going to start working on a project where I need to have a decent understanding of Assembly language for the PIC microcontroller's. I'm intimately familiar with C/C++, so I know how to code for the most part, and I have done many projects for the PIC

Free alternative to MPLAB (PIC development)

拈花ヽ惹草 提交于 2019-12-03 05:24:31
I started using MPLAB recently, but for someone that works with Eclipse and VS the IDE it's very limited. Do you know any free IDE or how to configure Ecplise or Netbeans to PIC development? Thanks all The underlying toolchain (compiler/linker etc.) can be used from any environment including Eclipse and Visual Studio, though Eclipse is probably the more flexible in this respect. MPLAB has a feature to export a project as a makefile that can be used with GNU make, although you may rather generate your own makefile, or use the project management provided by Eclipse. In Visual Studio, create a

Best way to get started with programming other things than your computer? [closed]

守給你的承諾、 提交于 2019-12-03 02:10:48
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . What is the best way to get started with programming things outside of your computer? I don't mean mainstream things like cell phones with APIs. Please assume working knowledge of C/C++ 回答1: Brian, you might find the Arduino interesting. It is inexpensive and pretty popular.

How can I make my own microcontroller?

好久不见. 提交于 2019-12-03 00:52:54
问题 How can I make my own microcontroller? I've done some work using GAL chips and programmed a chip to do simple commands such as add, load, move, xor, and output, but I'd like to do something more like a real microcontroller. How can I go about doing this? I've read a little bit about FPGA and CPLD, but not very much, and so was looking for some advice on what to get and how to start developing on it. 回答1: Look here for a good wiki book. I had some coursework I wrote when I was teaching

AVR or PIC to start programming Microcontroller? [closed]

南楼画角 提交于 2019-12-03 00:40:42
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Which family should I start to learn? (Never did any programming on microcontroller) 回答1: Today AVR and PIC are probably the most