Control register + Demux

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
YuCh_3947976
Level 3
Level 3
10 replies posted 5 replies posted 10 questions asked

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?

pastedImage_0.png

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

pastedImage_1.png

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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

View solution in original post

6 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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

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

do you know what wrong with it?

pastedImage_1.png

0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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

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
0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

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

Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

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:

pastedImage_2.png

Regards

Ekta