revolution counter


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    it is in the code above:

    with this it works:
    ADCON1 = %00000010
    Define ADC_BITS 10 ' Set number of bits in result


    but not:

    ADCON1 = %10000010
    Define ADC_BITS 8 ' Set number of bits in result

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Right, with one you're putting the 10 bit value (justified left) into a byte, with the other, you're putting the 10 bit value (justified right) into a byte, trying to stuff 10 bits into a spot for 8 bits.
    So, with one, you get the lower 8 bits of the 10 bits, with the other you get the upper 8 bits of the 10 bits.
    Which one is it? That's for you to figure out....(hint: if you use a word variable for reading, you'll figure it out quickly if you also use the LCD to display that value)

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I am using the same config as the sample program on melabs:
    http://www.melabs.com/resources/samples/pbp/adcin8.bas

    as you can see mine is not working.

    k

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    I am using the same config as the sample program on melabs:
    http://www.melabs.com/resources/samples/pbp/adcin8.bas
    as you can see mine is not working.
    k
    Except that they're using 8 bits and a byte, and you tried using 10 bits and a byte.
    (hint: see the hint above about the hint in post #25)

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    oups, ok i was sleepy last night,


    thanks for your help

    ken

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    oups, ok i was sleepy last night,
    thanks for your help
    ken
    All good then?

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Yep its good,

    I am just working on reset, so many options, I just want to put zero my values in a push of a button, I think I will just use a pin low pin high, and a loop in my program that verifies this pin.
    I read about power on reset, but I never used it and it is unclear in the documentation I read so far.

    k

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 07:14
  2. Counter not counting !!!
    By lerameur in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 20th February 2009, 23:15
  3. Replies: 42
    Last Post: - 14th January 2008, 12:38
  4. 20 Digit Virtual LED Counter
    By T.Jackson in forum Code Examples
    Replies: 9
    Last Post: - 19th November 2007, 06:02
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27

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