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


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    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

  2. #2
    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).

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


    Did you find this post helpful? Yes | No

    Question

    No, you can only check one byte(8bits) in one go. You're also trying to check several bits at the same time, only one is "allowed". If you really MUST check for something more complicated you'll need to rewrite the code yourself. Certanly possible but nothing i will help you with.

    Good luck.
    /Ingvar

    PS. Is there a perticular reason why you can't use 10 bits and scale the result as i showed you in my last post? DS.

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


    Did you find this post helpful? Yes | No

    Default

    Where is the result stored - in result_l or result_h or are they the same ?

    At U = Umax there should be a value of 1024.

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


    Did you find this post helpful? Yes | No

    Post

    Result_h is the high byte(8bits) of the wordsized(16bits) result. Result_l holds the lower 8 bits.

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


    Did you find this post helpful? Yes | No

    Default

    I don't understand this. How do you combine these two to get a Dez-number between 0 and 1023 ?

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


    Did you find this post helpful? Yes | No

    Red face

    Ok, time for somebody else to step in. I don't have the patience, time and/or languageskills to explain how hex, binary and decimal correlates. I recommend that you buy a book that expalins the basics of "microcontrolling". Can't give you any advice on good books since i haven't needed one for 20 years.

    Good luck
    /Ingvar

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