OwenDuffy.net 


Factorise integer

This calculator calculates the prime factors of a big integer. It is intended to assist in determination of clock dividers and counters for microcontroller timing applications.

The input is limited to 10 digits due to the computational load of larger numbers. This is sufficient for 32 bit binary numbers, and should be sufficient for calculating current micro contoller counter/timer prescaling / division factors.

Characters other than digits will be stripped from the strings, so you may use commas or stops as thousands separators.

Enter integer:
 

Example 1

An ATMega328P MCU has a 16MHz clock and we want a 100ms timer interrupt. The prime factors of 1,600,000 (16MHz/10Hz) are 2^9 * 5^5. So, if this MCU has a /256 clock prescaler available for the timer, we need 2^1 * 5^5 - 1 = 6249 in the timer register which will need to be at least 13bits, so a 16bit counter will suffice.

Example 2

An ATTiny45 MCU has a 18.432MHz clock and we want a 100ms timer interrupt. The prime factors of 1,843,200 (18.432MHz/10Hz) are 2^13 * 3^2 * 5^2. So, using this MCU's /8 clock divider and /1024 clock prescaler available for the timer, we need 3^2 * 5^2 - 1 = 224 in the timer register which will need to be at least 8bits, so an 8bit counter will suffice.

Example 3

An ATTiny25 MCU has an 11MHz clock and we want a 440Hz square wave from the timer (880 transitions per second). The prime factors of 50,000 (11MHz/880Hz) are 2^4 * 5^5. So, using this MCU's /8 clock divider, we need 2^1 * 5^5 - 1 = 6249 in the timer register which will need to be at least 13bits, so a 16bit counter will suffice.

 

Other VK1OD tools.


© Copyright: Owen Duffy 1995, 2016. All rights reserved. Disclaimer.