Delta-Sigma-ADC in Assembler embedded in PBP, increasing resolution


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    blainecf's Avatar
    blainecf Guest


    Did you find this post helpful? Yes | No

    Default More info please.

    By deliberate do you mean 8bits, 12 bits, 19bits??? Are you just wanting to know what was implicitly set (by default) that makes this 16 bit? What is your ultimate goal?

    bcf

  2. #2
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Thank you for your question.

    Exactly, I want to know how it subdivides in 1024 steps. Then it should be easy to change it to the desired value.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    well i certainely miss something here but, 1024 steps it's 10Bit. you said you want Increase your actual 16Bit resolution.. euh... i'm i wrong or what.

    By the way, why using the comparator when a real ADC give you already 10Bit resolution without headache, need few lines of code and no big additional hardware?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    These lines checks for 1024 passes through the loop and stops if reached.

    andlw 0x04 ; Are we done? (We're done when bit2 of
    btfsc STATUS,Z ; the high order byte overflows to 1).

    All you need to do is change ....

    andlw 0x04

    ..... to .......

    andlw 0x02 for 512(9 bits)
    andlw 0x08 for 2048(11 bits)
    andlw 0x10 for 4096(12 bits)
    andlw 0x20 for 8192(13 bits)
    andlw 0x40 for 16384(14 bits)
    andlw 0x80 for 32768(15 bits)

    If you need better resolution it can be done, but needs more changing in the code.

    /Ingvar

  5. #5
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Thank you so far.

    In my current application, I need around 750 steps. Surely I could use 1024 steps right now.

    I want to change it to the number of steps wanted, but I have not understood the relation yet.

    Please explain the math behind your examples.
    Last edited by selbstdual; - 15th September 2006 at 01:42.

  6. #6
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    The code checks if bit 2 of the high byte of the wordsized variable "counter" is set. If it is, the program has looped around 1024 times, if not it keeps looping.

    There is really no math involved, 1024dec = 0400hex = 0000010000000000bin.

    You don't want to check for anything more complicated than if a single bit is being set or cleared. That would slow the ADconversion down, not something you want to do. I'm not saying it can't be done, just that it wouldn't be very easy. Especially if you don't know assembler and i get the impression that you don't.

    My advice is that you stick with 10 bits(1024) and when the conversion is complete you scale the result to your desired value. That can be done in various ways. Here's a few..... all will scale to 752.

    Dummy = ADresult * 752
    ScaledResult DIV32 1024

    ScaledResult = ADresult */ 188 '752/1024*256=188

    ScaledResult = ADresult ** 48128 '752/1024*65536=48128

    /Ingvar

  7. #7
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    What about using

    Code:
    andlw 0x2F0 ; Are we done? (We're done when bit2 of
    btfsc STATUS,Z ; the high order byte overflows to 1).

Similar Threads

  1. Delta Sigma ADC is inverting
    By selbstdual in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th January 2007, 15:35

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