Category Archives: Uncategorized

Arduino Inline Assembly Tutorial (Tables)

Often, the fastest way to compute something on an arduino is to not compute it all. Huh? For example, trigonometric functions are costly operations and can abruptly slow your application to the pace of a crawl. And many times, the … Continue reading

Posted in Uncategorized | Tagged , , , , , | 4 Comments

Arduino Inline Assembly Tutorial (Strings)

Addressing Modes When loading and storing data, there are several addressing methods available for use. The arduino’s AVR microcontroller supports 13 address modes for accessing the Program memory (Flash) and Data memory (SRAM, Register file, I/O Memory, and Extended I/O … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Arduino Inline Assembly Tutorial (Branching)

Loop and Branch Branching is a fundamental feature of computers. For example, branching allows a computer to repeat instruction sequences. One of the most  basic forms of repetition is a “loop”, and the loop is probably the most widely used … Continue reading

Posted in Uncategorized | Tagged , , , , , | 2 Comments

Towards a More General digitalRead

The arduino digitalRead function is a nice bit of code. However, it takes more than a cursory glance to determine exactly how it performs (see Yak Shaving). It also compiles into approximately 222 bytes of code, and its slow in … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Arduino Inline Assembly Tutorial (Math)

Increment, Decrement, Add and Subtract INC is a mnemonic for INCrement. INC adds one to the contents of the register placing the result back into the register. The C flag in the Status Register (SREG) is not affected by the … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Arduino Inline Assembly Tutorial (Bit Shifts)

Introduction In this tutorial we continue our examination of bit operations. Specifically we discuss left and right shifts. We’ll end this tutorial with an assortment of short C language MACRO code segments that demonstrate checking bits. Shift to Multiply The … Continue reading

Posted in Uncategorized | Tagged , , , , , | 1 Comment

Arduino µC Status Register (SREG)

Like all microcontrollers the arduino’s AVR µC has a flag register to indicate various conditions. The Status Register is referred to in short as the “SREG”, and can be directly referenced inline using __SREG__. It is an 8-bit wide register, … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment