Forum Index > General > Ask an Evil Mad Scientist!
 A to D tutorial ?
 |  Printable Version
By: Windell (offline) on Sunday, April 04 2010 @ 10:41 PM PDT  

Could. Try rephrasing with as a division by a factor of two -- i.e., a right-shift operation (>>4 etc.), and see if that makes a difference.

Windell H. Oskay

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
By: karlgg (offline) on Monday, April 05 2010 @ 02:38 PM PDT  

For something like that, I think it'd be faster/smaller to add another, smaller variable for a countdown... Set it to 500 and decrement it... Then once it's at zero you can do what you want, and reset it to 500.

That way, from a math standpoint, you're not doing anything beyond a DEC and JZ (or whatever the AVR mnemonics might be) and only a couple of bytes of storage. And, you'll only have to perform any big math on the larger number when (or if) it becomes important on its own.

I think I am, therefore I am... I think
Forum Mad Scientist
Mad Scientist

Status: offline

Registered: 01/25/09
Posts: 81

Profile Email    

 All times are PDT. The time is now 03:15 AM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to Post 
Filtered HTML Allowed 
Censored Content 

Evil Mad Scientist Forum Archives — Read only!

Please visit our new forums for new discussions.

DIY Hardware for Electronic Art

The Original Egg-Bot Kit

Interactive LED kits

Meggy Jr RGB
LED matrix game
development kit.

Business-card sized
AVR target boards

Peggy 2
LED Pegboard kits

My Account

Lost your password?