ADC multiplex with 4051


Results 1 to 8 of 8

Threaded View

  1. #8
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by RFsolution View Post
    Offcourse I forgot the brackets

    I made one error in my explanation

    the first mux is on AN0 the second one AN1
    so in the middle of the for nextloop i need to switch to ADCIN 1

    Your single loop for ADCin0 and 1 is not clear to me
    Yes, I did leave out setting PORTC in my single loop example. If you are using AN0 and AN1, try this.
    Code:
    for i = 8 to 23
      PORTC = i
      if i < 16 then
        ADCIN 0, AD[i-8]
      else
        ADCIN 1, AD[i-8]
    next i
    You can also use a single analog input by tying the outputs (Z pin) of the muxes together to AN0 then the code is simplified to this. Insert appropriate delays in both cases.
    Code:
    for i = 8 to 23
      PORTC = i
      ADCIN 0, AD[i-8]
    next i
    Last edited by rmteo; - 20th March 2010 at 01:23.

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