2 Replies Latest reply on May 26, 2011 9:31 AM by chris.hartley

    mixed mode pins.

    chris.hartley

      I am trying to design some flexible I/O, for example a pin could be configured at runtime to be a input, output, PWM or ADC.  In the pin datasheet it states:

         

      "An analog Pins component may also support digital input or output connections, or both, as well
      as bidirectional connections. It is possible to short together digital output and analog signals on
      the same pin. This can be useful in some applications; however, it is an advanced topic and
      should be used with care."

         

      This seems to indicate this is possible, but when I tried to hook up a port of pins that configured as both analog and digital to an Analog Hardware Multiplexer, I get the following error:

         

      "mpr.M0098:Signal "Port4_0 is expected to connect to an analog pin but instead connect to Port_4(0).  Please fix the connection."

         

      Am I going about this the wrong way?  Is there more documentation about the "advanced topic" of having a pin be both digital and analog?

        • 1. Re: mixed mode pins.
          grsm

           there are 2 issues here.

             

          1 is that you can only connect analog pins to the analog hardware mux, hence the error.

             

          if you want to have a pin that is a digital output, digital input and an analog input, when you select a pin, (any type) double click on the box, then on the type pop up, tick analog, DI and DO with HW connections.

             

          then connect say a PWM to the DO, a gate or something to the DI, and the ADC to the analog stub. then when you want to change between modes (i.e. not be a pwm output but read an ADC measurement, then use the component API's to change the drive mode.

             

           

             

          this should gove you the functionality you requested, though what application this would be used for is another question :)

             

           

             

          hope this helps.

             

          graham

          • 2. Re: mixed mode pins.
            chris.hartley

            I was able to get rid of the errors by using the regular analog mux instead of the hardware mux.  I'm not sure I understand the difference in this case yet.  I'll have to do some functional testing to see if I'm really getting the functionality I am looking for.  As for the application, my device will be installed in many different applications.  Some may need lots of PWM control, but little ADC, others may be the opposite.  This gives the user the ability to fit the hardware to his particular installation needs.