6 Replies Latest reply on Apr 19, 2020 11:15 PM by MoTa_728816

    Control register + Demux

    YuCh_3947976

      Hi,as below pic,can I set the two pins output at the same time?

      I use the command ( Control_Reg_Write() ),it's just can set one at a time.

      if it can not set outputs at the same time,have any way to realize it?

       

      and I am not sure about configure mean of control register,does output numbers of the control register correspond to demux output numbers?

        • 1. Re: Control register + Demux
          MoTa_728816

          Hi,

           

          If I can assume that your PSoC 4 has UDB, I would do something like

           

          000-schematic.JPG

          This way you can set

          0: none output

          1 or 2 : output one

          3: output both

           

          Similarly you can use output port with output enable.

          001-schematic2.JPG

           

          0: none output

          1 or 2 : output one

          3: output both

           

          moto

          1 of 1 people found this helpful
          • 2. Re: Control register + Demux
            EktaN_26

            Hello,

             

            The datasheet of the De-Multiplexer component mentions that only one of the output signal is driven based on the select input. Thus it is not possible for the two pins to output at the same time.

             

            According to me the method suggested by moto would be required if you want both the pins to output at the same time.

             

            In the above case, you would require the following setting for control register:

             

            Regards

            Ekta

            2 of 2 people found this helpful
            • 3. Re: Control register + Demux
              YuCh_3947976

              when I connect two input port on line,it will notice error like below picture,

              do you know what wrong with it?

              • 4. Re: Control register + Demux
                MoTa_728816

                Hi,

                 

                I just tested with CY8CKIT-044 and it worked as below.

                But in your schematic, I'm afraid that the red-highlighted place may not be connected.

                Could you double check the connection?

                 

                schematic

                001-schematic2.JPG

                pins

                003-pins.JPG

                PWM config

                004-PWM-config.JPG

                main.c

                ===========

                #include "project.h"

                #include "stdio.h"

                 

                int main(void)

                {

                    uint8_t mode = 0 ;

                   

                    CyGlobalIntEnable; /* Enable global interrupts. */

                    PWM_Start() ;

                   

                    for(;;)

                    {

                        Control_Reg_Write(mode) ;

                        mode = (mode + 1) % 4 ; /* mode = 0, 1, 2, 3, 0, ... */

                        CyDelay(10) ;

                    }

                }

                ===========

                 

                The oscilloscope display

                IMG_4180.JPG

                 

                moto

                1 of 1 people found this helpful
                • 5. Re: Control register + Demux
                  YuCh_3947976

                  Hi,I also use CY8CKIT-044 and do it with your method successfully

                  but I still have a question about that why do you set the mode from 0 to 3

                  as I known,Control_Reg_Write←this command is to write a byte to a control register and your control register just only have two output

                  • Add to Phrasebook
                    • No word lists for English -> Traditional Chinese...
                    • Create a new word list...
                  • Copy
                  • 6. Re: Control register + Demux
                    MoTa_728816

                    Hi,

                     

                    > I also use CY8CKIT-044 and do it with your method successfully

                    I'm happy hearing that!

                     

                    > but I still have a question about that why do you set the mode from 0 to 3

                    > as I known,Control_Reg_Write←this command is to write a byte to a control register

                    > and your control register just only have two output

                     

                    It was only showing that the method is working,

                    so the value did not have much meaning.

                     

                    But I wanted make it explicit that I was controlling only 2 lower bits.

                    And to show the pattern I wanted to keep the oscilloscope pattern precise and uniform.

                     

                    For example if I wrote

                    =============

                    while(1) {

                         for (i = 0 ; i < 5 ; i++ ) {

                             Control_Reg_Write(i) ;

                         }

                    }

                    =============

                    There will be non linear pattern between i = 3, 4, (and 0).

                     

                    I'm sorry, but I could not figure out what the following part meant.

                    ===============

                    • Add to Phrasebook
                      • No word lists for English -> Traditional Chinese...
                      • Create a new word list...
                    • Copy

                    ===============

                     

                    moto

                     

                    1 of 1 people found this helpful