Monthly Archives: October 2014

Cheap ATMEL AVR ISP ICE from QinHeng

I bought this small USB stick from eBay.  It supposedly can do JTAG and many other cool stuff for ATMEL microcontrollers. Anyway, here is the detail how to use it: The other end of the stick has dual-line 10-pin connector.  … Continue reading

Posted in Uncategorized | 2 Comments

Using PicKit2 Programmer to program Atmel’s microcontrollers

Many hobbists are familiar with Arduino kit.  This beast uses various Microcontrollers from Atmel.  For example, Arduino UNO uses AtMega 328p. Normally, we use the pcb kit to program the chip, as the Arduino (or the clones) use USB to … Continue reading

Posted in Uncategorized | 2 Comments

Left shift by negative number used to test unique characters in a string

What is the outcome of this?val=-32;mask = 1<<val;I tried to execute it on Python, it failed with error message.But if I do it in C or C++, I get something else.  Turn out, this depends o the compiler and CPU … Continue reading

Posted in Uncategorized | Leave a comment

The Use of c++decl

cdecl and c++decl are two nice tools to check syntax or to generate declaration of C and C++ respectively. for example, using c++decl (the text in bold is the one we type):$ cdeclType `help’ or `?’ for helpc++decl> c++decl> declare … Continue reading

Posted in Uncategorized | Leave a comment

Odd Numbers with Parity

#!/usr/bin/pythontable=[]for n in range(0,256): p=False while n: p = not p n &= n-1 table.append(p)parity_odd = [] print “Odd numbers with Parity:” for i in range(0,256): if (i%2) and (table[i]): parity_odd.append(i) print i, Result: Odd numbers with Parity:1 7 11 … Continue reading

Posted in Uncategorized | Leave a comment

Fastest Fibonacci Sequencer

This algorithm is based on Fast-doubling  as explained in Fast Fibonacci algorithms. Given F(k) and F(k+1), we can calculate these equations: F(2k) = F(k)[2F(k+1)−F(k)]F(2k+1) = F(k+1)2+F(k)2. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 … Continue reading

Posted in Uncategorized | Leave a comment