[TUT][code] unsigned multiply for the ATTiny, assembly

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Routines for multiplying unsigned values by a constant.

Here is how to make assembly routines suitable for the ATTiny with no multiply instruction.
Included are some example routines see attached code..

ROUTINE #CYCLES
8 bit multiplied by 10 10
8 bit multiplied by 100 18
8 bit multiplied by 1000 34
8 bit multiplied by 10000 28
8 bit multiplied by 60 18
8 bit multiplied by 99 21
16 bit multiplied by 10 15

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you aware of aplication notes AVR200 and AVR200B? :wink:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also libC has a mul10 function.

AVR200, 16 x 16 takes 105 cycles and the 8 x 8 takes 34.