Code Improvement


Results 1 to 6 of 6

Threaded View

  1. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You can remove all the division if:

    loop 16 times

    for I = 0 to 15

    Since Charles has suggested to simplify deviding by 4 , then 16 x 4 = 64, so if you devide by 64 you will do only one division.

    AdcValue = sample/64

    or

    AdcValue = sample >> 6


    Hence, you don't need to change variable:

    HPWM 1, AdcValue, 5000

    Naturaly writing to CCPRxL, and CCPxCON4:5, as suggested in the previuos post is an additional improvement.



    Cheers

    Alberto
    Last edited by aratti; - 1st December 2010 at 12:33.
    All progress began with an idea

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts