Dhananjay Khairnar @. Powered by Blogger.

26 January 2016

Arm Programming:

Aim : Find Prime Factors of hard coded number and display it on LCD on timer 0 interrupt.

Requirement :

1.ARM micro controller kit (i used LPC1768 blueboard NXG ).
3 Flash magic


Structure of included files in keil 4.7

void findFact(uint16_t num)

        int count=2;
        factCount = 0;
        while( (num != 1) | (num < 0) | (count >10) )
                if(num % count == 0)
                    num = num/count;
                    fact[factCount] = count;
                    count = 2;

Description :
in above programe we are going to take any hardcoded number and find its prime factors.
>take while loop wich iterate for while remainder is not less than 0.
>take one counter start from 2 
>find mod of number divide by counter
> if it is 0 the divide num by counter and store again in num
>and store counter as prime factor in array fact[factCounter] here factCounter is the number of prime factor
>if not increment counter
>as while loop condition fails we gwt our all prime factor.

Topic covered :
 >Timer interrupt
 >lcd interface ARM7

About DK

Hi, My Name is DK. I am a embedded system designer and embedded programmer. I am a certified holder of Diploma in Embedded system designing. We have a team of professinal programmers, developers work together and implement innovative concepts.


Post a Comment