cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

New Contributor II

Hi everyone,

I am trying to configure a counter at 1 MHz frequency to generate an interrupt. At every interrupt point, the processor is supposed to read a 32 pin input value. For this purpose, I need to configure two operations-

1. Configure 32 pins as input and read them with one instruction. ( such as 32 pin port read with one register value)

2. Configure a counter to trigger the read after 1 microsecond.

I have gone through the tutorial videos but I couldn't find any way to configure 32 pin port as a digital input.

Could anyone help me with the right resources to do the required operations? (Tutorial/Documentation etc.).

Thanks.

0 Likes
Reply
1 Solution
Employee

Hello,

All ports in PSoC6 device are of 8 bits. You can use 4 different ports to read the data and store it in one 32 bit variable as shown below.

uint32_t data;

data = (GPIO_PRT9->IN << 24 | GPIO_PRT8->IN << 16 | GPIO_PRT7->IN << 8 | GPIO_PRT6->IN );

Note: The data bits have to be connected in the order PORT6 to PORT9 (LSB to MSB).

Thanks,

Yeshwanth

View solution in original post

6 Replies
Employee

Hello,

All ports in PSoC6 device are of 8 bits. You can use 4 different ports to read the data and store it in one 32 bit variable as shown below.

uint32_t data;

data = (GPIO_PRT9->IN << 24 | GPIO_PRT8->IN << 16 | GPIO_PRT7->IN << 8 | GPIO_PRT6->IN );

Note: The data bits have to be connected in the order PORT6 to PORT9 (LSB to MSB).

Thanks,

Yeshwanth

View solution in original post

Esteemed Contributor II

You could use 4 status registers connected to your input pins. A single strobe to all registers in parallel wil give you a snapshot of the 32 bits.

To avoid the registers you may use the inclock capability of the pins component, see datasheet.

Bob

New Contributor II

Hello Bob,

Thank you for your suggestion. I couldn't understand "A single Strobe " completely is it routing the pins into one register?

I would really appreciate if you could explain it a little bit.

Thanks.

0 Likes
Reply
Esteemed Contributor II

Here you go...

Bob

0 Likes
Reply
New Contributor II

Hello Yeshwanth,

Thank you for your reply. In the pin map, I have to define them as input and configure them manually in the code right?

I am new with PSoC that's why I am making sure.

Thanks.

0 Likes
Reply
Employee

PSoC creator will initialize all the pins automatically. You just have to place the pins on the Top Design, configure them as input in GUI and select a pin map.

test.png

Thanks,

Yeshwanth

0 Likes
Reply
Top labels