Timer0 Reload based on ADC result


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    My ADC value is 200 (50 Hz) and my new table has 72 entries from 0 to 350 in steps of 5.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    timer0 reload value = FFFFh - 5Mhz / (36*(8/4)(200)) = 65535 - 347 = 65188
    If you haven't changed the prescaler it should work according to your equation.

    5MHz/(72*(8/4)*(200)) = 5MHz/28,800=173.6

    65,535-173=65,362!

    If you go by equation 3 in AN900 it would be around 65,447 for a reload value.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Jan 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I will test the software on my development board and see if I get a sine wave of 50Hz or not. Maybe Proteus is not simulating the program at the right clock speed.

    Thanks

Similar Threads

  1. Stable Adc Reading Routine
    By gebillpap in forum General
    Replies: 27
    Last Post: - 13th May 2015, 02:18
  2. Strugling without floating point
    By pjsmith in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th March 2011, 06:29
  3. ADC problem with PIC16F917
    By eetech in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th March 2007, 21:22
  4. ADC value with 2 decimals on an LCD
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2005, 15:54
  5. PBP 16-bit ADC result math
    By sonic in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th March 2005, 14:21

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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