Category Archives: Uncategorized

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 #4 (Constraints)

Introduction I have a confession to make. My previous examples were not very efficient assembly code. That might seem like an odd comment, especially since my typical example used just 2-4 lines of code. But, these examples were coded as … Continue reading

Posted in Uncategorized | Tagged , , , , , | 5 Comments

Arduino Inline Assembly Tutorial #3 (Clobbers)

Clobbered Guess what? Our previous tutorial example (Tutorial #2) has a problem. Here is the inline portion of that code: Notice in our example, we use register #26, or r26. Even though we only used this register temporarily, we have … Continue reading

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

Arduino Inline Assembly Tutorial #2 (Extending asm)

The Extended asm Statement The first tutorial in this series can be found here and covers a great amount of necessary background material. The general form of an extended inline assembler statement is: asm(“code” : output operand list : input … Continue reading

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

Arduino Inline Assembly Tutorial #1 (Basic asm)

Motivation Learning inline assembly language on the Arduino AVR 8-bit platform is a daunting task for many (at least it was for me). Besides the cryptic syntax and the high level of understanding the semi-official documentation assumes, there exists very … Continue reading

Posted in Uncategorized | Tagged , , , , , | 3 Comments

Lean and Mean Float to String Conversion (ftoa)

Here is an often requested, basic float to ascii conversion function (ftoa). The typical method for arduino to perform this conversion is to use either of the dtostrf() or sprintf() functions. Both of these library functions incorporate the same underlying … Continue reading

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

Floating Point Precision and Binary 32 or, Arduino Don’t Know Math

Did you know? 0.1 + 0.2 = 0.30000001 Try this simple arduino program to prove it: First, don’t be alarmed, and second, don’t throw your arduino into the trash thinking it’s defective. Its working just fine. For comparison, performing this … Continue reading

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