Continueous ADC scanning using DT interupts


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    i've just spotted this bit...

    Figure 21-5 shows the operation of the A/D converter
    after the GO/DONE bit has been set, the
    ACQT2:ACQT0 bits are set to ‘010’ and selecting a
    4 TAD acquisition time before the conversion starts.


    Which indicates that the program doesn't need to execute a wait before 'hitting go'...

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    And later it tells you this
    After the A/D conversion is completed or aborted, a
    2 TAD wait is required before the next acquisition can be
    started. After this wait, acquisition on the selected
    channel is automatically started.
    Look at Figure 21-1, all of the ANX's go to the same converter. Needs a little time between reads...
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I must be awake now because it's starting to make sense...
    I hadn't spotted the bit that allows manual acquisition... but in normal mode will do the acquisition automatically before the conversion.
    And that's what was confusing me...

    [shakes head] seems obvious now...

    Thanks for the help

  4. #4
    JohnMacklo's Avatar
    JohnMacklo Guest


    Did you find this post helpful? Yes | No

    Default

    Try to do this. I have been used this for a while, and it works fine for my purposes.

    Loop:
    gosub LeeEntradaAnalogica ' calls to subroutine LeeEntradaAnalogica".
    goto Lazo
    end



    LeeEntradaAnalogica:
    Auxiliar = 0
    For J1 = 0 To 9
    ADCIN H2, Auxiliar ' Guarda el valor del canal analógico en la variable "Auxiliar"
    AnlgInput[H2] = AnlgInput[H2] + Auxiliar
    for J2 = 0 to 50
    pause 1
    next J2
    Next J1
    AnlgInput[H2] = (AnlgInput[H2] /10) ' Divide el valor de Canal[H2] entre 10 para obtener un promedio.
    If AnlgInput[H2] < 0 Then ' Si el valor obtenido es menor que 0.
    AnlgInput[H2] = 0 ' significa que el valor leido en el canal no es real.
    EndIf
    If AnlgInput[H2] > 1023 Then ' Si el valor obtenido es mayor que 1023.
    AnlgInput[H2] = 1023 ' significa que el valor leido en el canal no es real.
    EndIf
    Return

    I think the comments don't matter. sorry but I think in spanish.
    By the way, this piece of code is embedded in a program that uses DT interrupts. Darrel Taylor Rules!

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